Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Functions using multiple textboxes


Message #1 by "bb" <barbarab@h...> on Wed, 23 Jan 2002 14:52:20
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>


  Return to Index