Hi all ...

Let me first of all warn you I'm not really good a Javascript (jet) [img]images/smilies/xeye.gif[/img]

I want to calculate a total for a form and alert if some conditions aren't met ...

I'm going completely crazy here ... so any help would be appreciated.. here's the deal ..

there is 4 input's with name A - D their values need to be between 0 -50 and the total must be 50 exactly .....

this is what I got so far
PHP Code:
function Optellen()
{
var 
total
total 
0
document.CQS.A.value
document.CQS.B.value
document.CQS.C.value
document.CQS.D.value

if('' ) { }
if(
'' ) { }
if(
'' ) { }
if(
'' ) { }

total += eval(A)
total += eval(B)
total += eval(C)
total += eval(D)

if (
total 50)
{
alert("The total can not be more than 50" )
}
else
{
document.CQS.total.value total
}




1 there must be an easier way .. two I keep getting NaN as an answer...

Please help

Edit:

I'm using the PHP code tag so I get nice outlined code but ofcourse it's javascript