close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文件</title>
<script language="javascript">
function numcheck(id,time){
var re = /^[0-9]+$/;
if (!re.test(time.value)){
alert("只能輸入數字");
document.getElementById(id).value="";
}
}
</script>
</head>
<body>
<form>
<input type="text" id="aaa" onkeyup="numcheck(this.id,this)" />
</form>
</body>
</html>
全站熱搜
留言列表