JavaScript

Moderators: None (Apply to moderate this forum)
Number of threads: 2061
Number of posts: 5164

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
iframe desigmode="On" and catch mouse-clicks Posted by MarkOh on 29 Oct 2002 at 12:57 AM
This message was edited by MarkOh at 2002-10-29 0:58:46

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
<%=nameFrame%>.focus();
<%=nameFrame%>.isHTMLMode = false;

<%=nameFrame%>.document.write('<HTML><HEAD><title>asdfs</title><script language=JavaScript>
var message="Function Disabled!";	function click(){ if (event.button==2){	alert(message);	return false; }}
document.onmousedown=click; <'+'/script></HEAD><BODY><link REL="stylesheet" href="'+styleCSS+'" TYPE="text/css"><%=data%></BODY></HTML>');

<%=nameFrame%>.document.designMode="On";
<%=nameFrame%>.focus();


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


Report
Re: iframe desigmode="On" and catch mouse-clicks Posted by borislav on 29 Oct 2002 at 1:27 AM
: This message was edited by MarkOh at 2002-10-29 0:58:46

: 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
:
: <%=nameFrame%>.focus();
: <%=nameFrame%>.isHTMLMode = false;
: 
: <%=nameFrame%>.document.write('<HTML><HEAD><title>asdfs</title><script language=JavaScript>
: var message="Function Disabled!";	function click(){ if (event.button==2){	alert(message);	return false; }}
: document.onmousedown=click; <'+'/script></HEAD><BODY><link REL="stylesheet" href="'+styleCSS+'" TYPE="text/css"><%=data%></BODY></HTML>');
: 
: <%=nameFrame%>.document.designMode="On";
: <%=nameFrame%>.focus();
: 

:
: 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\nstring line2\nstring line3";

Report
Re: iframe desigmode="On" and catch mouse-clicks Posted by MarkOh on 29 Oct 2002 at 1:46 AM
thanx for the reply.

what you say is true, but all this text
<%=nameFrame%>.document.write('<HTML><HEAD><title>asdfs</title><script language=JavaScript>
var message="Function Disabled!";	function click(){ if (event.button==2){	alert(message);	return false; }}
document.onmousedown=click; <'+'/script></HEAD><BODY><link REL="stylesheet" href="'+styleCSS+'" TYPE="text/css"><%=data%></BODY></HTML>');

is one line, but for the post on this forum i made a couple of linebreaks in it to make the reading easier.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.