order of page loading?

i have a login page where a background image is loaded and the focus is set to the first textbaox:<br />
<br />
<br />
<body background="Projects/back2.png" onLoad=setFocus()><br />
<br />
<br />
the function:<br />
<br />
<!--<br />
function setFocus()<br />
{<br />
document.forms[0].elements[0].focus();<br />
document.forms[0].elements[0].select();<br />
}<br />
//--><br />
<br />
<br />
The problem i have is that sometimes it takes a while for the background image to load, and when this happens, the focus is not set to the first textbox. the cursor is only placed there after the image has loaded.<br />
<br />
this presents some probs for the user, because they cannot type immediately (the delay is the prob).<br />
<br />
is there a way for me to set the focus to the textbox before the image has loaded?<br />
<br />
THANKS!<!--content-->I think yes, remove the background statement from the body tag<br />
<br />
background="Projects/back2.png"<br />
<br />
and put it in the function <br />
<br />
function setFocus(){<br />
document.forms[0].elements[0].focus();<br />
document.forms[0].elements[0].select();<br />
document.body.background="Projects/back2.png"<br />
}<br />
<br />
<br />
or a little variation of the above should work..<!--content-->thanks, i did this, and it seems to work, just not sure if it really does (i may just have a fast connection at the moment):<br />
<br />
<br />
<body onLoad=setFocus(); background="Projects/back2.png";><!--content-->:D <br />
you are welcome..<br />
If there is nothingelse that is interferring,it will work. just the logic makes it work.<!--content-->
 
Back
Top