"Paul Fitzpatrick" <pa******@internode.on.net> wrote in message
news:41******@duster.adelaide.on.net...
<snip>
if (document.forms[0].elements[0].value > max)
The above line can't do what you want. document.forms[0].elements[0].value
returns a string and you are trying to compare a string to a number. I'm no
expert but this should do it. HTH
Jimbo
<HTML><HEAD><TITLE>numbers fun</TITLE>
<script type=text/javascript>
function checkIt() {
alert(document.forms[0].elements[0].value + 3);
// if you entered 7 should = 73
// the above returns a string '7' and appends 3
alert( (+ document.forms[0].elements[0].value) + 3);
// if you entered 7 should = 10
// the + operator forces the string to an integer
}
</script></HEAD>
<BODY>
<form><input name="blah" type="text"></form>
<button onclick = "checkIt()">type a number into the box and click
me</button></form>
</BODY></HTML>