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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting field focus - What is up with my code ??? 1

Status
Not open for further replies.

southbeach

Programmer
Jan 22, 2008
879
US
I use this all the time, today, I cannot get it to work.

Here is the code
Code:
<div id="LoginLayer" style="position:absolute; left:784px; top:21px; width:200px; height:72px; z-index:1;">
<form name="LogInForm" id="LogInFormID" method="post" action="/magnet/index.php?TargetID=login">
    User Code<img src="images/spacer.gif" width="5px" height="1px" />
    <input name="netusercode" id="netusercodeID" type="text" size="25" maxlength="25" class="login" />

    <br />Password<img src="images/spacer.gif" width="12px" height="1px" />
    <input name="netusercode" id="netusercodeID" type="password" size="25" maxlength="25" class="login" />
    <img src="images/spacer.gif" width="115px" height="1px" />
    <input name="netlogin" type="image" src="images/login_hdr_but.gif" border="0" onClick="this.submit();" />
</form>
</div>

<script language="JavaScript">
    document.LogInForm.netusercode.focus();
</script>
</body>

I get JS error saying
Code:
document.LogInForm.netusercode.focus is not a function
What am I missing and/or doing wrong?
 
netusercode is assigned to more than one field, similarly the corresponding id, that's why.
 
Cut & Paste is not always your best friend ... God I feel like an idiot [ponder]

I looked at this code for hours and I just gave up on it ... I always thought that the simplest of code is the one to always get you.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top