Javascript focus help!

Teensweb

New Member
Messages
352
Reaction score
1
Points
0
i have a division with the following attribute
HTML:
<div onload=javascript:document.form1.txtCaptcha.focus()>
Why doesn't this work?
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
should be:

<body onload=javascript:document.form1.txtCaptcha.focus()>

..
 

Twinkie

Banned
Messages
1,389
Reaction score
12
Points
0
If you want to be up to XHTML standards, enclose the statement in double quotes. Also, you can omit the "javascript:" because you only need that in links.
Code:
<body onload="document.form1.txtCaptcha.focus();">

~Twinkie
 
Top