Click to See Complete Forum and Search --> : edit boxes


swstos
04-06-2003, 08:42 PM
I am trying to write a script to do the follow:

there are 2 edit boxes... First i will write a number in the first edit box and after another number in the second box... In the second edit box it must not let me to write a number bigger than the number in the first edit box...

When i stop writing in the second edit box it must display a message to say that it must be lower than the number in the first edit box...

I try to do it but since i am a newbie in javascript i dont know what is the name of the event...

My try is:

<html>
<head>
<title></title>
</head>
<SCRIPT LANGUAGE="JavaScript">
function CHECK(){
if (parseInt(document.submitform.two.value) > parseInt(document.submitform.one.value))
{
alert("Please insert a smaller number than the first edit box ");
return "out of range";
}
}

</SCRIPT>

<body>
<FORM ACTION="next.asp" METHOD="post" name="submitform">
<input type = "text" name = "one" value="" size="20">
<BR>
<input type = "text" name = "two" value="" size="20">
</FORM>
</body>
</html>


Can please anyone help me...

Thanks in advance...

swstos
04-06-2003, 09:34 PM
Now its displaying the message when you submit the form...

what i am trying to do is to display the message as soon as you finish writing the number in the edit box

is there an event called *onfocus* in the edit box in order to execute the function as soon as you move out from the edit box...?

thanks for the help.

swstos
04-06-2003, 09:44 PM
thanks for the help