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

Problem with refering to form elements

Status
Not open for further replies.

bigS47

Programmer
Jun 29, 2006
20
CA
Usually when you want to refer to a form element you do this:

document.formname.elementname.value

however, the way my javascript is made i need to use a variable that stores the name of the element to refer to it. For example:

var a = namefield;
document.formname.a.value;

However, all this does is looks for an element called 'a'.
Any Ideas on what I can do?
 
Thanks soo much. I was trying so many different things, i forgot about something as simple as that.
 
star.gif
You're welcome!

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top