本人初学者 请帮忙看下下面代码为什么没有执行其中的函数
<html>
<head>
<script language="javascript">function checkNum(num)
{
if (num=="")
{
alert("请输入一个数字值");
return false;
}
if (isNan(num))
{
alert("请输入一个数字");
return false;
}
else alert("谢谢!");
}</script>
</head><body> <form>
请输入一个数字:
<input type=text onChange="checkNum(this.value)">
</form>
</body>
</html>
<html>
<head>
<script language="javascript">function checkNum(num)
{
if (num=="")
{
alert("请输入一个数字值");
return false;
}
if (isNan(num))
{
alert("请输入一个数字");
return false;
}
else alert("谢谢!");
}</script>
</head><body> <form>
请输入一个数字:
<input type=text onChange="checkNum(this.value)">
</form>
</body>
</html>
看来javascript对函数名大小写很敏感!呵呵
汗! 你还是好好去看看书吧, 别来CSDN混了, 不要有问题就问, 自己多思考.
js大小写敏感是在任何一本js教程中第一章都有的!
<html>
<head>
<script language="javascript"> function checkNum(num){
//alert(num);
if(num==""){
alert("请输入一个数字值");
return false;
}
if(isNaN(num)){
alert("请输入一个数字值");
return false;
}else{
alert("谢谢。");
}}
</script>
</head>
<body>
<form>
请输入一个数字:
<input type=text onkeyup="checkNum(this.value)">
</form>
</body>
</html>