为什么提交不了
我的聊天室中的文本框用的是textarea,本来按提交按钮就可以提交了,可我又加了个按ctrl+enter来提交,这是我在一个小程序中试的没问题的,也就是在我那个小程序中两种都可以提交,可在我的聊天室中就不行了,只能通过ctrl+enter来提交,如果你用提交按钮来提交的话,它就会一直提交是你上一次用ctrl+enter提交的内容,让我很是郁闷,我把一段比较关键的代码帖出来,请高手指教,多谢了:function send(){
if(window.event.ctrlKey && window.event.keyCode==13){
var post_msg=document.af.post_msg.value
var msg=document.af.msg.value
var zh=document.af.zh.value
while(post_msg.indexOf(">") != -1 || post_msg.indexOf("<") != -1 || post_msg.indexOf(" ") != -1 || post_msg.indexOf(" ") != -1 || post_msg.indexOf(",") != -1 || msg.indexOf(" ") != -1 || msg.indexOf(" ") != -1 || msg.indexOf(",") != -1 || msg.indexOf("<") != -1 || msg.indexOf(">") != -1 || zh.indexOf("操") != -1 || msg.indexOf("操") != -1){
post_msg = post_msg.replace(" ","");
post_msg = post_msg.replace(" ","");
post_msg = post_msg.replace(",","");
post_msg = post_msg.replace("<","<")
post_msg = post_msg.replace(">",">")
msg = msg.replace(" ","");
msg = msg.replace(" ","");
msg = msg.replace(",","");
msg = msg.replace("<","<")
msg = msg.replace(">",">")
msg = msg.replace("操","*")
zh = zh.replace("操","*")
}
if (msg==''){alert('请输入发言或动作!');document.af.msg.focus();return false;}
if (msg==post_msg){alert('请不要重复发言!!');document.af.msg.focus();return false;}
else{
this.document.af.post_msg.value=msg;
this.document.af.zh.value=msg;
this.document.af.submit();
this.document.af.msg.value='';
this.document.af.tu.value='0';
setTimeout('document.af.Submit.disabled=0',3000);
document.af.msg.focus();
}
}
}
var winbgcolor = parent.cbg();
var winbgimage = parent.cbi();
document.writeln("<body bgcolor=" + winbgcolor + " background=" + winbgimage + " bgproperties=fixed topmargin=3>");
</script>
<form name="af" method="post" target="f3" action='post.asp' onkeydown='return send()'>
<p>
<input type=text name='username' value='' readonly style="text-align:center;font-size:12px;color:008888" size=10 maxlength=10>
<br>
</p>
<table width="730" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50" height="29">发言人: </td>
<td width="133"><input type=hidden name=post_msg value='' />
<input type=hidden name=zh value='' />
<select name='addwordcolor' onchange="document.af.msg.focus();bs(document.af.addwordcolor.value)" style='font-size:12px'>
<option style="background-color:008888;color:008888" value="008888" selected>默认</option>
<option style="background-color:000000;color:000000" value="000000">黑色</option>
<option style="background-color:0088FF;color:0088FF" value="0088FF">海蓝</option>
<option style="background-color:0000FF;color:0000FF" value="0000FF">亮蓝</option>
<option style="background-color:000088;color:000088" value="000088">深蓝</option>
<option style="background-color:888800;color:888800" value="888800">黄绿</option>
<option style="background-color:008888;color:008888" value="008888">蓝绿</option>
<option style="background-color:008800;color:008800" value="008800">橄榄</option>
<option style="background-color:8888FF;color:8888FF" value="8888FF">淡紫</option>
<option style="background-color:AA00CC;color:AA00CC" value="AA00CC">紫色</option>
<option style="background-color:8800FF;color:8800FF" value="8800FF">蓝紫</option>
<option style="background-color:888888;color:888888" value="888888">灰色</option>
<option style="background-color:CCAA00;color:CCAA00" value="CCAA00">土黄</option>
<option style="background-color:FF8800;color:FF8800" value="FF8800">金黄</option>
<option style="background-color:CC3366;color:CC3366" value="CC3366">暗红</option>
<option style="background-color:FF00FF;color:FF00FF" value="FF00FF">紫红</option>
<option style="background-color:3366CC;color:3366CC" value="3366CC">蓝黑</option>
</select></td>
<td width="65">对话:</td>
<td width="319" rowspan="2"><textarea name="msg" cols="50" rows="4" id="msg" ></textarea></td>
<td width="53"> </td>
<td width="52"> </td>
<td width="58"> </td>
</tr>
<tr>
<td height="32">对话人:</td>
<td><input type=text name='towho' value='大家' readonly onclick=javascript:document.af.towho.value='大家';document.af.msg.focus(); style="text-align:center;font-size:12px;color:008888" size=10 maxlength=10 />
<select name='sayscolor' onchange="document.af.msg.focus();bs(document.af.sayscolor.value)" style='font-size:12px'>
<option style="background-color:660099;color:660099" value="660099" selected>默认</option>
<option style="background-color:000000;color:000000" value="000000">黑色</option>
<option style="background-color:0088FF;color:0088FF" value="0088FF">海蓝</option>
<option style="background-color:0000FF;color:0000FF" value="0000FF">亮蓝</option>
<option style="background-color:000088;color:000088" value="000088">深蓝</option>
<option style="background-color:888800;color:888800" value="888800">黄绿</option>
<option style="background-color:008888;color:008888" value="008888">蓝绿</option>
<option style="background-color:008800;color:008800" value="008800">橄榄</option>
<option style="background-color:8888FF;color:8888FF" value="8888FF">淡紫</option>
<option style="background-color:AA00CC;color:AA00CC" value="AA00CC">紫色</option>
<option style="background-color:8800FF;color:8800FF" value="8800FF">蓝紫</option>
<option style="background-color:888888;color:888888" value="888888">灰色</option>
<option style="background-color:CCAA00;color:CCAA00" value="CCAA00">土黄</option>
<option style="background-color:FF8800;color:FF8800" value="FF8800">金黄</option>
<option style="background-color:CC3366;color:CC3366" value="CC3366">暗红</option>
<option style="background-color:FF00FF;color:FF00FF" value="FF00FF">紫红</option>
<option style="background-color:3366CC;color:3366CC" value="3366CC">蓝黑</option>
</select></td>
<td> </td>
<td><p>
<input type="submit" name="Submit" value="提交"/></td>