Web Analytics Made Easy -
StatCounter iframe & designmode="on" focus not working on chrome... - CodingForum

Announcement

Collapse
No announcement yet.

iframe & designmode="on" focus not working on chrome...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • iframe & designmode="on" focus not working on chrome...

    Hi, i have the following html page


    <html>
    <head>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
    </head>
    <body>
    <input type="text" id="input1" /><br />
    <iframe id="textEditor" name="textEditor">
    </iframe>
    <script type="text/javascript">
    $(document).ready(
    function()
    {
    textEditor.document.designMode = "on";
    textEditor.document.open();
    textEditor.document.write('<head><style type="text/css">body{ font-family:arial; font-size:13px;}</style><body>Hi User<br /><br /><span style="font-style:italic;">### Write your message here ###</span><br /><br />Thanks,<br /></body></head>');

    document.getElementById("textEditor").contentWindow.addEventListener('focus', OnFocus, true);
    $("#input1").focus();
    }
    );

    function OnFocus()
    {
    textEditor.document.body.innerHTML = textEditor.document.body.innerHTML.replace('<span style="font-style:italic;">### Write your message here ###</span>', "");
    document.getElementById("textEditor").contentWindow.focus()
    }
    </script>
    </body>
    </html>


    Now press on the tab key when the page loads (You should see focus on the textbox field) and you can see that the iframe text editor (WYSIWYG) has no focus... On firefox it works... How can i give it focus on chrome?
Working...
X
😀
🥰
🤢
😎
😡
👍
👎