Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

new page - make something active 1

Status
Not open for further replies.

andycape

Programmer
Aug 22, 2003
177
ZA
on opening a new page how do i make a certain text box or button or whatever active (so if its a text box you can just start typing you dont have to tab or click to the box).

I tried tabIndex, but dosnt work.

thanx
 
try this

<body onload=&quot;javascript:document.forms(0).elements(0).focus()&quot;>

this will focus the cursor on the first element on the first form on the page
 
thanks, thats helpfull for one of my pages, but the other the element number will constantly be different, is there a way to do it by calling the textbox by name ?

 
actually i could use that method, but is there a way to say &quot;so many elements from the total&quot;

ie : if there are 50 elements on the page, i want to focus on 12 from the total so it would be element 38, and next time their are 60 elements so it would be 48 ?

or am i talking in circles ;-)
 


you can change the form name or the element name like this.


<body onload=&quot;javascript:document.forms(&quot;formName&quot;).elements(&quot;elementName&quot;).focus()&quot;>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top