...

View Full Version : IE Loses Focus in WYSIWYG Editor



danielnz
07-10-2011, 09:41 PM
Hi All,

Having a real problem with IE losing focus when clicking outside the wysiwyg iframe. This works fine in Firefox, Chrome, Safari, Opera.



<html>
<head></head>
<body>

<script type="text/javascript">

function initializeEditor() {

contentEditor.document.designMode='on';

}

function insertHTML1() {

var html = "<em><u>Some Text</u></em><p>2. Select this text<p><strong></u>Some text</strong>";

document.contentEditor.focus();
range = contentEditor.document.selection.createRange();
document.contentEditor.focus();
range.pasteHTML(html);

}

function insertHTML2() {

var html = "<strong>INSERTED TEXT</strong>";

document.contentEditor.focus();
range = contentEditor.document.selection.createRange();
document.contentEditor.focus();
range.pasteHTML(html);

}

</script>

<iframe name="contentEditor" id="contentEditor" onLoad="initializeEditor();"></iframe>

<p><input type="button" value="1. Click Here" onClick="insertHTML1()">

<p><input type="text" value="3. Click Here">

<p><input type="button" value="4. Click Here" onClick="insertHTML2()">

</body>
</html>


To demonstrate, first follow steps 1, 2 and 4. This works fine!

Introduce step 3, clicking in a field outside the iframe and focus is lost.

Appreciate any help!!
Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum