l***@gmail.com
2005-07-15 20:14:25 UTC
Hey all,
I have a page where I have two iframes and both iframes have designMode
turned on. Above the iframes, I have some attribute controls for font,
color, etc. I need to be able to capture an onfocus events when either
iframe is selected (for "toolbar context"). However, I'm unable to do
this either by adding an onfocus="" property in the HTMl or by adding
an event in listener (iframe.addEventListener(),
iframe.contentWindow.addEventListener()) in JS.
Can anybody recommend a way to do this?
lpsantil
PS - There seems to be a weird bug where I'm only able to turn
designMode on in JS for more than one frame ONLY if I use a script
src="" to include it. Anybody else notice this?
-------test.html-------
<html>
<head></head>
<body>
<p><iframe id="a" width="200" height="100"
onfocus="alert(0)"></iframe></p>
<p><iframe id="b" width="200" height="100"
onfocus="alert(1)"></iframe></p>
<script src="test.js" type="text/javascript"></script>
</body>
</html>
-------test.js-------
document.getElementById( "a" ).contentWindow.document.designMode =
"on";
document.getElementById( "b" ).contentWindow.document.designMode = "on";
I have a page where I have two iframes and both iframes have designMode
turned on. Above the iframes, I have some attribute controls for font,
color, etc. I need to be able to capture an onfocus events when either
iframe is selected (for "toolbar context"). However, I'm unable to do
this either by adding an onfocus="" property in the HTMl or by adding
an event in listener (iframe.addEventListener(),
iframe.contentWindow.addEventListener()) in JS.
Can anybody recommend a way to do this?
lpsantil
PS - There seems to be a weird bug where I'm only able to turn
designMode on in JS for more than one frame ONLY if I use a script
src="" to include it. Anybody else notice this?
-------test.html-------
<html>
<head></head>
<body>
<p><iframe id="a" width="200" height="100"
onfocus="alert(0)"></iframe></p>
<p><iframe id="b" width="200" height="100"
onfocus="alert(1)"></iframe></p>
<script src="test.js" type="text/javascript"></script>
</body>
</html>
-------test.js-------
document.getElementById( "a" ).contentWindow.document.designMode =
"on";
document.getElementById( "b" ).contentWindow.document.designMode = "on";