Hi below is a section of my code. I dont get the desired out put for else if ( txt3Val.value >= txt4Val ) but if I adjust it to else if ( document.getElementById('txt3') >= document.getElementById('txt4') ) it works. Can someone tell me why this happens? Thanks.
......AND THE CODE READS
else if(document.form1.GWchk.checked == true)
{
var txt3Val = document.getElementById('txt3');
var txt4Val = document.getElementById('txt4');
if(txt3Val.value == "" || txt4Val.value == "")
{
alert ("You need to enter both starting and ending number \nof the cheque book for GlW."); return false;
}
else if ( txt3Val.value >= txt4Val )
{
alert ("Ending cheque number should be of greater value"); return false;
}
else
{
alert ("Successfully saved your entry1."); return false;
}
}
HIGHLIGHT : Sorry the code else if ( txt3Val.value >= txt4Val.value ) also doesnt work! Actually that's what its there on my real script a re-write error here. But the my preoblem remains the same where it doesnt give me the ending number should be greate.... and straight goes to successfully saved.
EDIT I think I figure out something. On the first text box if I put '10' as a value and second as '9' then JS seems doesn't recognize 9 as a lower value. But if I put '09' it gives the desired out put. How do I handle this?
valuefor<input>txt4Val.valuein that if statement?