Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing arguments into function issues

Status
Not open for further replies.

onressy

Programmer
Joined
Mar 7, 2006
Messages
421
Location
CA
This is what i'm trying to do, any thought on why this isn't working? Thanks

onChange="addit(fieldName1,aa1,v1);" // for the first field

onChange="addit(fieldName2,aa2,v2);" // for the 2nd field and so on....

//function:

function addit1(FieldName, DivValu, DivID) {
if (document.MainForm.FieldName.value>'0') {var A1 = eval(document.MainForm.FieldName.value);}else{A1=0;}
if (document.MainForm.FieldName.value>'0') {var A2 = eval(document.MainForm.FieldName.value);}else{A2=0;}
if (document.MainForm.FieldName.value>'0') {var A3 = eval(document.MainForm.FieldName.value);}else{A3=0;}
if (document.MainForm.FieldNamevalue>'0') {var A4 = eval(document.MainForm.FieldName.value);}else{A4=0;}
DivValu = eval(A1 + A2 + A3+ A4);
document.getElementById("DivID").innerHTML = DivValu;
if (DivValu > 100) { alert("Total cannot be greater than 100 percent!");return false;}
}


I'm getting error that aa1 is underfined , or for question 2 that aa2 is underfined
 
[cheers]

Dave

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...east is east and west is west and if you take cranberries and stew them like applesauce
they taste much more like prunes than rhubarb does
[infinity]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top