0

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 .. 
}

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Airshow
0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.