mb***@yahoo.com wrote:
Neither of those worked. Both caught 0 as invalid but neither caught
the high end. Here's the full function, it was writen by someone else
and I'm just trying to make it work.
Hi,
I made you a simple script, that tests what you try to do.
It works as expected.
-----------------------------
<html>
<head>
<script type="text/javascript">
function test() {
var pagevalue = document.forms.testform.myNum.value;
var maxpages = document.forms.testform.maxpages.value;
if ( (1 <= pagevalue) && (pagevalue <= maxpages) )
{
alert ("true!");
} else {
alert ("false!");
}
}
</script>
</head>
<body>
<form name="testform">
pagevalue: <input type="text" name="myNum">
<br>
maxpages: <input type="text" name="maxpages">
<br>
<input type="button" onClick="test();" value="doTest">
</form>
</body>
</html>
---------------------------
So I think the problem must be somewhere else.
Try adding alerts under:
var pno=numchk(objFrm.pageno.value);
var pagevalue=(objFrm.pageno.value);
to see if pno and pagevalue contain values you expect.
Actually, I alway debug by adding alerts, and in 90% of the cases I very
quickly find that I don't get the values in my vars that I expected in the
first place.
Also, casting values to Integer (ParseInt) can help.
Hope this helps. :-)
Regards,
Erwin Moller