I've tried to implement a cursor focus on an input area and IE has given my a lot of headaches. I've tried things along the line of (changing the timeout too, to large numbers):
setTimeout(function() { document.getElementById('myInput').focus(); }, 10);
and it won't work. I've noticed that I have an applet on the page as well, and when I remove the applet, the above works. Also if I put an alert before the focus()
trigger, it will work.
The applet doesn't do anything in particular (it actually retrieves the user's MAC address) and it makes one call to an external JS function at the end to send the MAC address to the DOM. I've tried putting the focus (timeout and all) at the end of that JS function but that won't work either.
What could be wrong? Things work well in Firefox, just not in IE.
Current setup:
//This is called from within the applet using a window.call
function everythingDone()
{
$("#someinput").focus();
//setTimeout(function() { document.getElementById('someInput').focus(); }, 1000);
};
$(function()
{
var applet = "<object classid='clsid:CAFEEFAC-0014-0002-0000-ABCDEFFEDCBA' width='0' height='0'><param name='code' value='someapplet.class' /><param name='archive' value='/someapplet.jar' /></object>";
$("#appletarea").html(applet);
//setTimeout(function() { document.getElementById('someInput').focus(); }, 1000);
});