You are here: irt.org | FAQ | JavaScript | DHTML | Q1711 [ previous next ]
Try:
<html> <head> <script language="JavaScript"><!-- function start() { if (document.getElementById) { document.getElementById('focusRequired').focus(); } else if (document.all) { document.all['focusRequired'].focus(); } else if (document.layers) { document.layers['myLayer'].document.forms['myForm'].elements['myText'].focus(); // or document.myLayer.document.myForm.myText.focus(); // or document.layers[0].document.forms[0].elements[0].focus(); } } //--></script> </head> <body onLoad="start()"> <layer name="myLayer" style="postion:absolute"> <form name="myForm"> <input type="text" name="myText" id="focusRequired"> </form> </layer> </body> </body> </html>