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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.