iframe desigmode="On" and catch mouse-clicks

[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

  • : [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";

  • 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.

Howdy, Stranger!

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

Categories