0 ppohlmann 7 Years Ago Hello Gurus, i have several forms on a page that get generated dynamicly form a database. Checking the fields etc requires an id for each form .. i have a problem with this code here. . elid is the id of the form .. the elid gets passed from the form itself .. it is a 5 digit number. My question is .. does that work this way ? I am fairly new to Java script and help would be appreciated. Thanks. function Setradio(elid) { var oucombinedscore =0; oucombinedscore=parseFloat(document.elid.pickscorehome.value) + parseFloat(document.elid.pickscorevisitor.value); etc etc .. } javascript Edited 5 Years Ago by mike_2000_17: Fixed formatting
0 Airshow 416 7 Years Ago ppohlmann, It's much easier to pass (a reference to) the form itself rather than its id. For example: <form ..... onsubmit="function Setradio(this);"> <!--or--> <input type="button" ..... onclick="Setradio(this.form)"> function Setradio(f){ var oucombinedscore = 0; oucombinedscore=parseFloat(f.pickscorehome.value) + parseFloat(f.pickscorevisitor.value); //etc etc .. } Airshow