My "if" statement - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

My "if" statement

CourtenayCourtenay Posts: 1Member
I'm sure my problem is very simple but I'll be darned if I can find it. I always get the default from my EITOT function
I have declared a two global variables at the top before all function definitions:
In the JavaScript I have:

var ETOT=0;
var ITOT=0;

function EI(field)
{
if(field.value==A)
ETOT=ETOT+1;
else
ITOT=ITOT+1;

}
function EITOT()
{ if(ETOT > ITOT)
document.REG.EI.value="E";
else
document.REG.EI.value="I";
}

I call the EI function with onBlur="EI(this);"
and the EITOT function with onBlur="EITOT();"

My value for document.REG.EI.value is always "I" even though I only send 'A' for the value to the EI function, hence only ETOT would be augmented. ETOT would, therefore, be greater than ITOT.

Can anyone give me a clue?
Thanks


Sign In or Register to comment.