I am maintaining a site in ASP, setting focus on a text box on a page on one page. Here's what I've tried:
& lt; Script type = "text / javascript" & gt; & Lt ;! - document.psForm ['password']. Focus (); // and document.getElementById ("password"). Focus (); - & gt; & Lt; / Script & gt;
I did not think it would work ... and it is not:
This does not work:
& lt; Body onload = "javascript: docuument.psForm.password.focus ();" & Gt;
Here's the form:
& lt; Form id = "psForm" action = "logonpw.asp" method = "post" & gt; & Lt; Table range = "0" cell padding = "5" & gt; & Lt; TR & gt; & Lt; TD & gt; Password: & lt; / Td> & Lt; TD & gt; & Lt; Input type = "password" name = "password" value = "& lt;% = password%>" Size = "50" & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / Form & gt;
Try this: Add:
id = "Password"
for input tag, then use:
document.getElementById ("password"). Focus ();
Comments
Post a Comment