Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

iframe desigmode="On" and catch mouse-clicks

MarkOhMarkOh Posts: 2Member
[b][red]This message was edited by MarkOh at 2002-10-29 0:58:46[/red][/b][hr]
I'am working on a wysiwyg editor and i would like to catch the mouse-buttons that are pressed inside the iframe
so i can make my own context menu. All works fine but as soon as i put the designmode on the javascript function
for the clicks doesn't work anymore.

here's the code
[code]
<%=nameFrame%>.focus();
<%=nameFrame%>.isHTMLMode = false;

<%=nameFrame%>.document.write('asdfs
var message="Function Disabled!"; function click(){ if (event.button==2){ alert(message); return false; }}
document.onmousedown=click; <'+'/script><%=data%>');

<%=nameFrame%>.document.designMode="On";
<%=nameFrame%>.focus();
[/code]

If i leave the designmode="On" away and i press the right mouse button
i get the message, but as soon as i put it back in my code it won't
work anymore.

What am i doing wrong


Comments

  • borislavborislav Posts: 16Member
    : [b][red]This message was edited by MarkOh at 2002-10-29 0:58:46[/red][/b][hr]
    : I'am working on a wysiwyg editor and i would like to catch the mouse-buttons that are pressed inside the iframe
    : so i can make my own context menu. All works fine but as soon as i put the designmode on the javascript function
    : for the clicks doesn't work anymore.
    :
    : here's the code
    : [code]
    : <%=nameFrame%>.focus();
    : <%=nameFrame%>.isHTMLMode = false;
    :
    : <%=nameFrame%>.document.write('asdfs
    : var message="Function Disabled!"; function click(){ if (event.button==2){ alert(message); return false; }}
    : document.onmousedown=click; <'+'/script><%=data%>');
    :
    : <%=nameFrame%>.document.designMode="On";
    : <%=nameFrame%>.focus();
    : [/code]
    :
    : If i leave the designmode="On" away and i press the right mouse button
    : i get the message, but as soon as i put it back in my code it won't
    : work anymore.
    :
    : What am i doing wrong
    :
    :
    :

    Hi,
    At first look all seems alright, but first thing that comes to my mind is that JavaScript didn't support multi lines strings. What this means:

    var a="string line1
    string line2
    string line3";

    will be incorrect expression and must be:

    var a="string line1
    string line2
    string line3";

  • MarkOhMarkOh Posts: 2Member
    thanx for the reply.

    what you say is true, but all this text
    [code]
    <%=nameFrame%>.document.write('asdfs
    var message="Function Disabled!"; function click(){ if (event.button==2){ alert(message); return false; }}
    document.onmousedown=click; <'+'/script><%=data%>');
    [/code]
    is one line, but for the post on this forum i made a couple of linebreaks in it to make the reading easier.
Sign In or Register to comment.