復制代碼 代碼如下:
<html xmlns="http://www.3lian.com/">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>js判斷輸入是否為數字</title>
<script language="javascript教程">
function ischeckNum()
{
var num = document.getElementById('isnum').value;
if( num )
{
if( !isNaN( num ) )
{
alert('是數字');
return false;
}
else
{
alert('你輸入的數據不是數字');
myfm.isnum.select();
return false;
}
}
else
{
alert('需輸入內容');
myfm.isnum.focus();
}
}
</script>
</head>
<body>
<form method="post" action="">
<label>
<input type="text" >
</label>
<label>
<input type="button" value="檢測是否為數字" >
</label>
</form>
</body>
</html>
新聞熱點
疑難解答
圖片精選