八荒圣祖286:这句javascript代码有什么错?

来源:百度文库 编辑:高考问答 时间:2024/05/13 07:25:28
我想谈出对话框,但是不行 是什么地方有问题呢?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="javascript">
function hs_yanZheng(text){

if text==""
alert("空值");
else
alert("有值");

}
</script>
</head>

<body>
<form name="form1" method="post" action="">
<input type="text" name="text1">
<input name="Submit" type="button" onsubmit="hs_yanZheng(text1.value);" value="按钮">
</form>
</body>
</html>

<input name="Submit" type="button" onsubmit="hs_yanZheng(text1.value);" value="按钮">

中type="button"改成submit,不然怎么有submit事件。
if text=="" 改成if(text=="")
-----------------------------------------
ok?