为什么javascript的报错没什么用
要崩溃了,为什么javascript的报错没什么用?
<?php
include("conn.php");
if(isset($_POST["submit"]))
{
$sql="INSERT INTO message (id,user,title,content,lastdate) " .
"values ('','$_POST[user]','$_POST[title]','$_POST[content]',now())";
//echo $sql;
$result = mysql_query($sql,$conn)or die(mysql_error());
}
?>
<SCRIPT language=javascript>
function CheckPost()
{
if (myform.user.value=="")
{
alert("please enter the name");
myform.user.focus();
return false;
}
}
</SCRIPT>
<form action="submit.php" method="post" name="myform" onsubmit="return CheckPost();">
user:<input type="text" name="user" value="" size="10" maxlength="40"/><br>
title:<input type="text" name="title"/><br>
content:<textarea name="content" rows="10" cols="50" ></textarea><br>
<input type="submit" name="submit" value="click"/>
</form>
[解决办法]
if (document.myform.user.value=="")