By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,253 Members | 1,690 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,253 IT Pros & Developers. It's quick & easy.

focus on first text form field w/o using onload

P: n/a
hello, is there any way to indicte a cursor on the first text user
input when a page loads without using onload in the body tag?
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"reneecccwest" <re**********@hotmail.com> wrote in message
news:c1*************************@posting.google.co m...
hello, is there any way to indicte a cursor on the first text user
input when a page loads without using onload in the body tag?

<html>
<head>
<title>focus.htm</title>
</head>
<body>
<form>
<input type="text" name="field1">
<input type="text" name="field2">
</form>
<script type="text/javascript">
document.forms[0].field1.focus();
</script>
</body>
</html>
Though, <body onload="document.forms[0].field1.focus()"> would be simpler.
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.