JS检验没有起到作用就提交了.没有经过校验 我的具体的代码如下

来源:百度知道 编辑:UC知道 时间:2024/06/01 11:42:26
<script language="JavaScript">
function checkform()
{
if(document.form.title.value=="")
{
alert("信息标题不能为空~!");
return false;
}
else if(document.form.class.value=="")
{
alert("信息类别不能为空值~!");
return false;
}
else if(document.form.comefrom.value=="")
{
alert("信息来源不能为空~!");
return false;
}

else if((document.form.keywords1.value)==(document.forms.keywords2.value)==(document.forms.keywords3.value)=="")
{
alert("三个关键字段不能同时为空值~!");
return false;
}
else if (document.form.contentinfo.value=="")
{
alert("信息的内容不能为空值~!");
return false;
}
return true;
}

</script>
<body>
<form action="insertcontent.jsp" name="form" method="post&qu

document.form.title.value
象这种方式最好不要这样写, 获得id名字的对象可以用

document.all.title.value,你的问题可能出在这,还有就是id名字不要用class这样的字,容易搞错,换个名字

用document.getElementById("")来取得对象