Automatically having the cursor in the text box

Look at this code:

   <HTML><TITLE>Drop down menu of publications</TITLE>
   <SCRIPT LANGUAGE="JavaScript">
// Identify browser
browserName = navigator.appName;
browserOK = true;
if (browserName == "Microsoft Internet Explorer")
browserOK = false;
if (browserOK) {
alert("Please use MICROSOFT INTERNET EXPLORER if you intend to use the 'Add HYPERLINK' button. This button will not work when using Netscape.")
//  -->
   <FONT SIZE=-2>
   Internet and Oracle database programming by <FONT COLOR=red>Marco Mastrocola</FONT>  email:<A HREF=""></A> &nbsp;
   <H2><BR><BR><CENTER>Choose a publication to edit<BR></H2>
   <FORM METHOD="post" ACTION="see_or_change.see_rec">
   Type in a publication number:<INPUT TYPE="text" NAME="typed_rec_in" SIZE=10 VALUE=" ">
   <INPUT TYPE="hidden" NAME="the_rec_number" VALUE="">
   <INPUT TYPE="submit"  VALUE="Show record">

All I want is for the cursor to automatically be in the text box when the page opens, instead of the user to have to click in the box before typing in a number.

How do I do it?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I don't see a <body> tag in your document, but, if one were there, use:

<body onload="document.forms[0].typed_rec_in.focus()">

Should do it.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Nathan Stanford SrSenior ProgrammerCommented:
Tom Post it as an Answer or I will what you suggest is the ANSWER.

Sorry, I just hate to have the unanswer questions lying around.
marcomaAuthor Commented:
That is just what I needed. Thanks.

As you can see, comments can be accepted as answers at any point by the questioner (but I agree about unanswered questions lying about).



It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.