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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.