111,119
社区成员
发帖
与我相关
我的任务
分享
<html:HTML xmlns:html="http://www.w3.org/1999/xhtml" xmlns:x="http://abc" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:js="urn:scripts">
<HEAD>
</HEAD>
<SCRIPT language="javascript" defer="true"><!--
//验证是否为数字
function singcheckNum(textobj)
{
if(isNaN(textobj.value)){
alert('请输入数字。');
textobj.focus();
return false;
} else {
return true;
}
}
function getfocus(textobj){
if(isNaN(textobj.value)){
alert('原值不是数字。');
textobj.focus();
return false;
} else {
return true;
}
}
--></SCRIPT>
<BODY>
<FORM id="form1">
<TABLE width="100%" align="center">
<TR>
<TD align="center"><span class="h2" id="sptitle">输入数字:</span>
<input id="sheBeiGongLv" type="text" onblur="singcheckNum(this)" onfocus="getfocus(this)" value="a"/>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>