On a Cold Fusion data entry form, is there a way to put the cursor in the first data entry field? I'm pretty sure I can do this with Java, but would like to avoid that if possible.
Use javascript in the <body> tag of your page.<br>
<br>
Use this syntax:<br>
<body onload="document.myform.myfield.focus();"><br>
<br>
With the code above you have to give your form and field a name eg name="myform" and name="myfield".<br>
With the next bit of code it will set the focus to the first element in the first form on your page. So no need to name your form, or specify its name in the code.<br>
<br>
<body onload="document.forms[0].elements[0].focus();"><br>
<br>
This should work on Netscape 3 upwards.<br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.