Click to See Complete Forum and Search --> : set cursor in text box when page loads


shareitall
02-24-2003, 05:13 PM
I have a simple form that requests username and password. I want the cursor to already be in the username field when they go to the webpage so they can simply start typing without clicking on the text box. How can I do this?

Thanks,
Eric

pyro
02-24-2003, 06:23 PM
Please look at the following example:

<html>
<head>
<title>Placing Focus</title>
<script language="javascript" type="text/javascript">
function placefocus()
{
document.myform.test.focus();
}
</script>
</head>
<body onLoad="placefocus();">
<form name="myform">
<p><input type="text" name="test">
</form>
</body>
</html>