关于HTML form表单onSubmit无法触发的而直接执行action跳转到下一网页的问题

照着书上一模一样抄的一段代码,直接写在记事本里的,用360和IE运行了好几遍每次点确定按钮都不会跳出alert警告窗口而直接执行action,是什么问题?
<html>
<head>
<meta http - equiv="Content - Type"content="text/html;charset=UTF-8">
<title>用户注册</title>
<script language="JavaScript"type="text/javascript">
function custCheck(){
var custName = document.getElementById("custName");
var email = document.getElementById("email");
var phone = document.getElementById("phone");
if(custName.value = "")
{
alert("客户名不能空!");
return false;
}
else if(email.value.indexOf("@") == -1)
{
alert("电子邮件中应包含@字符!");
return false;
}
else if(phone.value.length!=8)
{
alert("电话号码应该是8位数!");
return false;
}
}
</script>
<style type="text/css">
*,input{font-size:11pt;color:black}
</style>
</head>
<body>
<form action="/helloweb/inputCustomer"
method="post" onSubmit="return custCheck()" >
<table>
<tr><td>客户名:</td>
<td><input type="text"name="custName"id="custName"></td>
</tr>
<tr><td>Email地址:</td>
<td><input type="text"name="email"id="email"></td>
</tr>
<tr><td>电话:</td>
<td><input type="text"name="phone"id="phone"></td>
</tr>
</table>
<input type="submit"value="确定">
<input type="reset"value ="重置">
</form>
</body>
</html>

var phone = document.getElementById("phone"); // 括号是英文括号,你打成中文的了
if(custName.value = "") // 判断是 ==,你用的 =


照着上面改。

追问

啊啊~~~~原来是这么低级的错误QAQ,请问有没有适合html编程的软件推荐,能查错的。Myeclipse之类的除外,太大了。

追答

你是说 IDE 吗?

其实主要就是代码高亮,Notepad++、Sublime 都可以。如果再带上智能提示的话,推荐一款国产的 HBuilder。

温馨提示:答案为网友推荐,仅供参考