sudha sudha - 11 months ago 65
HTML Question

issue with comparing two numbers in javascript

my html code is like:

<SCRIPT type="text/javascript" language="JavaScript">
function fun()
var l = document.test.low.value;
var h = document.test.high.value;
if(l >h){
alert("low greater than high low is -"+l+"high is -"+h);


<form name="test">
<input type="text" size="11" id="low" />
<input type="text" size="11" id="high" />
<input type="button" value="sss" onClick="fun()"/>

when i compare this two values using low is 12 and high is 112 is not working.
like 22 and 122, 33 and 133 etc....

I am using IE browser version 8. please help.

Answer Source

try like this :-


or for floating Numbers you can use


or simply use