codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Page Load  timescale at 15:01 on Thursday, November 04, 2004
 

How do I have the cursor start/be placed in a test or list control when the screen is displayed?

  Re: Page Load  tgreer at 15:04 on Thursday, November 04, 2004
 

Modify the body tag. Add JavaScript to trigger "onload":

<body onload="document.form1.controlID.focus()" >

This assumes that your form is named "form1", and that the control you want to have focus has the ID "controlID".



<Added>

Of course, to be completely cross-browser, you could also use:

document.getElementById("controlID").focus()










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: Menu Problems
•  Re: Help: Trouble with z-Index and SELECT lists
•  Problen encounter when generate excel file using ASP
•  Re: Column count
•  AutoScoll
•  Re: email validation problem
•  Re: database and time date expire
•  Re: Page Load
•  Re: error in using


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2004