function VerifyInput()
{
strPage = form.page.value;
if(strPage == "")
{
alert("请输入你想跳转到的页数!");
form.page.focus();
return false;
}
if (/[^\d]/g.test(strPage))
{
alert("请输入数字!");
form.page.focus();
return false;
}
}
</script>
{
strPage = form.page.value;
if(strPage == "")
{
alert("请输入你想跳转到的页数!");
form.page.focus();
return false;
}
if (/[^\d]/g.test(strPage))
{
alert("请输入数字!");
form.page.focus();
return false;
}
}
</script>
{
alert("请输入数字!");
form.page.focus();
return false;
}
if (/[^\d]/g.test(strPage))if (isNaN(strPage) || parseInt(strPage) >0)
这是什么意思?javascript中有这样的函数吗?我看的书上怎么没有?
能不能介绍几本好书?
function check(theForm)
{
var checkOK = "0123456789.";
var checkStr = theForm.prod_price.value;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch == ".")
{
allNum += ".";
decPoints++;
}
else if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("只能输入 数字 。");
theForm.prod_price.focus();
return (false);
} if (decPoints > 1)
{
alert("请输入一个有效数字。");
theForm.prod_price.focus();
return (false);
}
</script>
is Not a Number的意思,中文意思就不用说了吧,parseInt是强制转化的函数