Hi, i need to help to learn this. Thanks in advance. <label>Value 1</label> <input type="text" id="value1" name="value1" /><br /> <script> var num1 = document.getElementById("value1"); parseInt(num1.value) // this gives an integer when you key in an integer in the input box. var num1 = document.getElementById("value1").value; parseInt(num1) // this gives NaN when you key in an integer in the input box. </script> May i know why the difference?
Should work both ways. How are you getting the value of the input filed? The reason for NaN is that you are getting the value when the field is empty.