设为首页收藏本站

新微赢技术网

 找回密码
 注册
搜索
热搜: 回贴
查看: 121|回复: 2
打印 上一主题 下一主题

为什么提交不了

[复制链接]
跳转到指定楼层
1#
发表于 2010-1-20 04:33:32 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我的聊天室中的文本框用的是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("<","&lt;")
post_msg = post_msg.replace(">","&gt;")
msg = msg.replace(" ","");
msg = msg.replace(" ","");
msg = msg.replace(",","");
msg = msg.replace("<","&lt;")
msg = msg.replace(">","&gt;")
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>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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>
[知识问答ωωω.χiuGoo.сom]
<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">&nbsp;</td>
<td width="52">&nbsp;</td>
<td width="58">&nbsp;</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>&nbsp;</td>
<td><p>
&nbsp;
<input type="submit" name="Submit" value="提交"/></td>
2#
发表于 2010-2-28 22:05:06 | 只看该作者
看了楼主的帖子,不由得精神为之一振,自觉七经八脉为之一畅,七窍倒也开了六窍半
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

申请友链|小黑屋|最新主题|手机版|新微赢技术网 ( 苏ICP备08020429号 )  

GMT+8, 2024-11-19 22:45 , Processed in 0.099611 second(s), 8 queries , Gzip On, Memcache On.

Powered by xuexi

© 2001-2013 HaiAn.Com.Cn Inc. 寰耽

快速回复 返回顶部 返回列表