[thelist] javascript - how to refer to (x)html elements

Tim Burgan burgan at iprimus.com.au
Wed Nov 12 20:01:12 CST 2003


hi jeff.

 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 : ----- Original Message ----- 
 : From: "Jeff Howden"
 : 
 : <snip>
 : you can take this a step further.  you don't even need to
 : know the number of the form in the forms array.  just pass
 : an object reference.  additionally, lose the onclick event
 : handler on the input button and move the collectInfo() function
 : call to the onsubmit event handler of the <form> tag:
 : 
 : <form action="" method="get"
 :       onsubmit="collectInfo(this.form)">
 : 
 : then, with some slight changes to your collectInfo() function,
 : you're done:
 :  
 : function collectInfo(oForm)
 : {
 :   var elementName = 'myName';
 :   var oElement = oForm.elements[elementName];
 :   alert('The value is ' + oElement.value);
 : }
 : 
 : .jeff
 : </snip>
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Yeah this makes even more sense.
Thanks

Tim



More information about the thelist mailing list