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

Focus work in IE but not Firefox

Status
Not open for further replies.

RPrinceton

Programmer
Jan 8, 2003
86
US
Hi Everyone,
Below is a javascript code snippet I use to position the insertion pointer on a field upon detecting an entry error. It works in IE but not Firefox. What obvious thing am I missing? I have not tried it with Opera or Netscape.
Please advise. Thx in advance.
Regards,
RPrinceton

code snippet:
function pos_csr(tabFld)
{
if (!tabFld)
{
}
else
{
document.getElementById(tabFld).focus();
}
}
 
Hi cLFlaVa,
I would be positioning at whatever form field is contained
in the variable named tabFld on an onLoad event.
Regards,
RPrinceton
 
Hi Everyone,
I have figured this one out. It appears that Firefox keys off of the id attribute for cursor positioning when using getElementById whereas IE only requires the name attribute. I simply added the id attribute to the HTML and it now works. See below.
<input type="text" id="somefld" name="somefld">
Regards,
RPrinceton
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top