
Untitled
By: a guest on
May 8th, 2012 | syntax:
None | size: 0.85 KB | hits: 9 | expires: Never
Editable iframe double-click not working in Opera and Firefox
<html>
<head>
<script type="text/javascript">
var iframeWin;
function iFrameOn(){
iframe1=document.getElementById("iframe1").contentWindow;
iframe1.document.designMode = 'On';
}
function html(){
iframeWin = document.getElementById("iframe1").contentWindow;
iframeWin.document.ondblclick = dblClicked;
}
function dblClicked(evt) {
evt = evt || iframeWin.event;
var target = evt.target || evt.srcElement;
if(target.tagName=="IMG"){
alert("Name: " + target.tagName + "; Src: " + target.src + "; Width: " + target.width + "; Height: " + target.height + ";");
} else {
alert(target.tagName);
}
}
</script>
</head>
<body onload="iFrameOn()">
<iframe name="iframe1" id="iframe1" onload="this.contentWindow.document.ondblclick=html;"></iframe>
</body>
</html>