JavaScript问题帮我看看,发生不了onBlur事件

来源:百度知道 编辑:UC知道 时间:2024/06/15 01:34:56
<html>
<head>
<title>无标题文档</title>
<script language="JavaScript">
function luqu()
{
var th=window.reform.mval.value;
if(th==")
alert("对不起,名字不能为空!");

</script>
</head>
<body>
<form name=reform method="POST">
<p>
请输入姓名
<p>
<input name=mval type=text size=7 onBlur="luqu()"><br>
<p>
请输入学号
<p>
<input type=textsize=4><br>
</form>
</body>
</html>
大家调一下,我弄了还是不行

<html>
<head>
<title>无标题文档</title>
<script language="JavaScript">
function luqu()
{
var th=window.reform.mval.value;
if(th=="")
alert("对不起,名字不能为空!");
}
</script>
</head>
<body>
<form name=reform method="POST">
<p>
请输入姓名
<p>
<input name=mval type=text size=7 onBlur="luqu()"><br>
<p>
请输入学号
<p>
<input type=textsize=4><br>
</form>
</body>
</html>

用这个就好使了

应该var th=document.reform.mval.value

var th=window.reform.mval.value;
window对象下面还有个document
if(th==") 掉了个"不?
alert("对不起,名字不能为空!"); 这个;怎么不是英文下的;

<input type=textsize=4>这里怎么连写了?