现代炕装修效果图大全:提交信息的时候,向数据库中写入相同的数据2次.怎么回事?

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/03 05:32:47
重复提交信息,不知道为什么?

<!--#include file="conn.asp"-->
<html>

<head>
<script LANGUAGE="javascript">
<!--
function checkspace(checkstr) {
var str = '';
for(i = 0; i < checkstr.length; i++) {
str = str + ' ';
}
return (str == checkstr);
}
function check()
{
if(checkspace(document.addmsg.title.value)) {
document.addmsg.title.focus();
alert("标题不能为空!");
return false;
}
if(checkspace(document.addmsg.sex.value)) {
document.addmsg.sex.focus();
alert("你没有选择性别!");
return false;
}
if(checkspace(document.addmsg.relation.value)) {
document.addmsg.relation.focus();
alert("关系项你还没选哦!");
return false;
}
if(checkspace(document.addmsg.name.value)) {
document.addmsg.name.focus();
alert("名字要写上!");
return false;
}
if(checkspace(document.addmsg.content.value)) {
document.addmsg.content.focus();
alert("内容你还没写呢!");
return false;
}
if(checkspace(document.addmsg.email.value)) {
document.addmsg.email.focus();
alert("如果你没有E-MAIL,随便填一个也行。-_-");
return false;
}

document.addmsg.submit();
}
//-->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>签写留言</title>
</head>

................

<form name="addmsg" method="post" action="addmessage_at.asp">
<input type="hidden" name="POST" value="True">
<table border="0" width="985" cellspacing="0" cellpadding="0">

............

<tr>
<td colspan="4">
<input onClick="return check();" style="border:1pt dotted green;background-color:#ffffff;width=60px" type=submit value="写 好 了">
<input style="border:1pt dotted green;background-color:#ffffff;width=60px" type="reset" value="重 新 写" name="重置">
</td>
</tr>
我知道哪里错了.把type=submit改成type=button就可以了

对呀,全发过来吧,最好把asp后台代码也发过来

你的表单内容给的不全呀,不知道错在哪里,再写全点。