Home > Backend Development > PHP Tutorial > 为什么里面的javascript没执行呢?貌似没执行CheckPost()判断啊该怎么解决

为什么里面的javascript没执行呢?貌似没执行CheckPost()判断啊该怎么解决

WBOY
Release: 2016-06-13 10:13:46
Original
939 people have browsed it

为什么里面的javascript没执行呢?貌似没执行CheckPost()判断啊?
 include("conn.php") ;
 include('head.php') ;
 if($_POST['submit'])
 {
  $sql="insert into message(id,user,title,content,lastdate) values('','$_POST[user]','$_POST[title]','$_POST[content]',now())";
  mysql_query("$sql") ;
  echo "发表成功!" ;
}

?>

 



  用户:

  标题:

  内容:





------解决方案--------------------
alert(“请填写用户”); 全角符号导致了浏览器解析错误吧
------解决方案--------------------
myform.user.value=="" js获取对象值有这种语法吗?

都改成这样 document.getElementByName("user").value;
------解决方案--------------------
function CheckPost(myform)
{
if (myform.user.value=="")
{
alert(“请填写用户”);
myform.user.focus();
return false;
}
if (myform.title.value.length{
alert("标题不能少于5个字符");
myform.title.focus();
return false ;
}
}




js参数都没传, "myform"哪来的啊
------解决方案--------------------
探讨
好了 ··呵呵 ··为什么会这样子啊?
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template