Code:
<script language="javascript">
var x = "10";
var y = 10 + parseInt(x);
alert(y);
var x1 = "The number is 10";
var y1 = 10 + parseInt(x1);
alert(y1);
function xyz(){
var b = document.fm.nm.value;
var c = parseInt(b)+10;
alert(c);
}
</script>
<form id="fm" name="fm">
<input type="text" id="nm" name="nm" />
<input type="button" value="Sum" onClick="xyz()" />
</form>
Comments
Post a Comment