I focus on controls in a web form like this:
<script language="javas cript">
var focusControl = null;
if (document.getEl ementById)
focusControl = document.getEle mentById('txtAr ea1');
else if (document.all)
focusControl = document.all['txtArea1'];
if (focusControl && focusControl.fo cus)
focusControl.fo cus();
</script>
This works on all of my textboxes and textareas except for 2. For them,
if I put a "alert(focusCon trol.id);" after the "focusControl.f ocus();",
then after the user clicks Enter the controlg gets focus. But if I
don't put that alert in there then the address bar (?!) gets focus.
How can I make this perfect and foolproof? I've looked at my HTML
thousands of times and the textareas are like all the others that work
without an alert box.
Thanks.
Comment