So, in the httpObject.responseText, I tried sending the following in addition to the search box markup:
Expand|Select|Wrap|Line Numbers
- <script type="text/javascript">
- document.getElementById('Message').focus();
- </script>
Expand|Select|Wrap|Line Numbers
- if(script) (window.execScript) ? window.execScript(script) : window.setTimeout(script, 0);
1. The JavaScript executes just fine - the focus goes to the search box - if I open the code of the search box directly as a page. I tried other ways of setting the focus which worked similarly but also failed similarly when using window.execScript.
2. I've tried other things in place of focus() and they all worked. A simple alert works, writing text to the box works but the focus is never set.
3. I found that if I included an alert in the eval function, the focus WOULD be set after I clicked OK. But that's clearly defeating the purpose of saving the user a click.
I doesn't actually bother me that IE users would get an inferior experience but this is such a curious problem I really want to know the answer.
Are there any IE experts here that can tell me?