<input type=" text"
可以帮忙说明一下吗? <>2是什么意思?
[CODE]<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!-- #include file="conn.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>:::判断输入框是否为数字:::</title>
</head>
<body bgcolor="#6699cc" onload="setup()" >
<form name="input_form" action="add_panduan.asp" method="post" onSubmit="return checkform();">
<input name="panduan" type="text" class="inputform1" id="panduan" onMouseOver="this.focus();" size="10">
<input type=submit value=完成录入 name=Submit>
<input type=reset value=清空重写 name=Submit_a>
</form>
<script language="JavaScript" >
function checkform()
{
var subst = document.input_form;
if (subst.panduan.value=="")
{
alert("对不起!判断内容不能为空哦!");
subst.panduan.focus();
return false;
}
if (subst.panduan.value!="")
{
if(onlyNum(subst.panduan.value)==0)
{
alert("对不起!判断内容只能输入数字!");
subst.panduan.focus();
return false;
}
}
return true;
}
function onlyNum(NUM)
{
var i,j,strTemp;
strTemp="0123456789";
if ( NUM.length== 0)
return 0
for (i=0;i<NUM.length;i++)
{
j=strTemp.indexOf(NUM.charAt(i));
if (j==-1)
{
//说明有字符不是数字
return 0;
}
}
//说明是数字
return 1;
}
</script>
</html>[/CODE]
[CODE]<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!-- #include file="conn.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>:::判断输入框是否为数字:::</title>
</head>
<body bgcolor="#6699cc" onload="setup()" >
<form name="input_form" action="add_panduan.asp" method="post" onSubmit="return checkform();">
<input name="panduan" type="text" class="inputform1" id="panduan" onMouseOver="this.focus();" size="10">
<input type=submit value=完成录入 name=Submit>
<input type=reset value=清空重写 name=Submit_a>
</form>
<script language="JavaScript" >
function checkform()
{
var subst = document.input_form;
if (subst.panduan.value=="")
{
alert("对不起!判断内容不能为空哦!");
subst.panduan.focus();
return false;
}
if (subst.panduan.value!="")
{
if(onlyNum(subst.panduan.value)==0)
{
alert("对不起!判断内容只能输入数字!");
subst.panduan.focus();
return false;
}
}
return true;
}
function onlyNum(NUM)
{
var i,j,strTemp;
strTemp="0123456789";
if ( NUM.length== 0)
return 0
for (i=0;i<NUM.length;i++)
{
j=strTemp.indexOf(NUM.charAt(i));
if (j==-1)
{
//说明有字符不是数字
return 0;
}
}
//说明是数字
return 1;
}
</script>
</html>[/CODE]