<?php
include ("mysql.php");
if ($_POST[submit]){
$con->_insert('information','id,user,password,email,code,regtime',"'','$_POST[user]','$_POST[password]','$_POST[email]','$_POST[code]',now()");
}
?>
<head>
<title>注册</title>
<link href="user.css" type="text/css" rel="stylesheet"/>
</head>
<body>
<div id="headers">
<div id="header"><span><a href="#">登录</a></span><span>|</span><span><a href="#">注册</a></span></div></div>
<div id="contenter">
<script language="javascipt" type="text/javascipt">
function checkpost(){
if (register.user.length<3){
alert("用户名小于3个字符");
register.user.focus();
return false;
}
if (register.password.length<5){
alert("密码小于5个字符");
register.password.focus();
return false;
}
if (register.email.value==""){
alert("请输入注册邮箱");
register.email.focus();
return false;
}
if (register.code.value==""){
alert("请输入验证码");
register.code.focus();
return false;
}
}
</script>
<div id="rig">
<ul>
<form action="user_reg.php" method="post" name="register" onsubmit="checkpost()" ><li>
用户名:<input type="text" name="user" size="25" maxlength="25"/></li><br/><br/><li>
密码:<input type="password" name="password"size="25" maxlength="30"/></li><br/><br/><li>
确认密码:<input type="password" name="passwords"size="25"maxlength="30"/></li><br/><br/><li>
注册邮箱:<input type="text" name="email"size="25" maxlength="50"/></li><br/><br/><li>
验证码:<input type="text" name="code"size="10" maxlength="10"/></li>
<li><img src="yanzhengma.php"/></li><br/><br/><br/><br/><li><input name="submit" type="submit" value="提交" /></li>
</form>
</ul>
</div>
<div id="right"></div>
</div>
</body>
</html>
这段中有一个JS脚本,但是为什么不起作用?这是用PHP跟HTML代码写出来的,外加JS脚本,如何才能让JS起作用,是不是位置放错了?