Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 0.85 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Editable iframe double-click not working in Opera and Firefox
  2. <html>
  3. <head>
  4. <script type="text/javascript">
  5. var iframeWin;
  6. function iFrameOn(){
  7.     iframe1=document.getElementById("iframe1").contentWindow;
  8.     iframe1.document.designMode = 'On';
  9. }
  10. function html(){
  11.     iframeWin = document.getElementById("iframe1").contentWindow;
  12.     iframeWin.document.ondblclick = dblClicked;
  13. }
  14. function dblClicked(evt) {
  15.     evt = evt || iframeWin.event;
  16.     var target = evt.target || evt.srcElement;
  17.     if(target.tagName=="IMG"){
  18.         alert("Name: " + target.tagName + "; Src: " + target.src + "; Width: " + target.width + "; Height: " + target.height + ";");
  19.     } else {
  20.         alert(target.tagName);
  21.     }
  22. }
  23. </script>
  24. </head>
  25. <body onload="iFrameOn()">
  26. <iframe name="iframe1" id="iframe1" onload="this.contentWindow.document.ondblclick=html;"></iframe>
  27. </body>
  28. </html>