try document.formname.textboxname
-----Original Message-----
From: bb [mailto:barbarab@h...]
Sent: Wednesday, January 23, 2002 6:52 AM
To: javascript
Subject: [javascript] Functions using multiple textboxes
I have a function referencing several textboxes on a form.
In the form instead of hardcoding each textbox name, I want to pass the
textbox (name??) to the function. I am able to pass the name, but the name
passes OK, but nothing works when referring to the passed name.
Am I correct to pass the textbox name? How do I refer to the textbox in
the function?
Example below
script language="javascript">
function togglefield(valname)
{
var valname; //name of associated textboxes
frm = document.test;
alert(valname);
{
valname.readOnly = false;
//frm.textboxfield1.readOnly = false;
}
}
</script>