JavaScript Tutorial/Global/isFinite
Версия от 18:52, 25 мая 2010; (обсуждение)
Global.isFinite()
The isFinite() method is used to determine if a variable has finite bounds.
<html>
<body>
<script lanuguage="JavaScript">
<!--
function checkNum(){
var n = document.form1.text1.value;
if(isFinite(n) == true){
alert("Your entry had finite bounds");
}else{
alert("Your entry had no finite bounds");
}
}
-->
</script>
<form name="form1">
Enter a number or character into the text box and then click the check value
button to verify if the input is a number.
<br><br>
<input type="text" name="text1" size=3>
<br><br>
<input type="button" value="Check value" onClick="checkNum()">
<br>
</form>
</body>
</html>