为什么老是提交两次呢,烦死啦100 分

goodoycg 2005-12-02 02:30:28
<!--#INCLUDE file="data.asp" -->
<html>
<head>
<title></title>
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<script language="Javascript" >
function PressKey()
{
if(window.event.keyCode==13)
{
document.form1.op.value='Send'
this.document.form1.submit();
// document.form1.Submit.Click();
}

}
function SetFocus()
{
document.form1.message.focus();
}

</script>

<%
on error resume next

op = request("op") ''客户的操作
if(vartype(op) < 2 or op = "")then
op="newcome"
end if
Select case op

Case "newcome"
'会议编号
Session("MeetingNo") = int(Request("MeetingNo"))
'此会议人数加1
dim MeetingManCountNewCome()
redim MeetingManCountNewCome(Application("MeetingCount") - 1)
for i = 0 to Application("MeetingCount") - 1
MeetingManCountNewCome(i) = Application("MeetingManCount")(i)
next
MeetingManCountNewCome(Session("MeetingNo") - 1) = MeetingManCountNewCome(Session("MeetingNo") - 1) + 1
Application.lock
Application("MeetingManCount") = MeetingManCountNewCome
Application.UnLock()
''进入会场提示
dim msgNewCome()
redim msgNewCome(Application("MeetingCount") - 1)
for i = 0 to Application("MeetingCount") - 1
msgNewCome(i) = Application("msg")(i)
next
msgNewCome(Session("MeetingNo") - 1 ) =cstr(time()) & "<font color=blue>" & " " & Session("Rname") & ":" & "</font>" & " " & "<font color=green>进入会场</font>" & "<br>" & msgNewCome(Session("MeetingNo") - 1 )
Application.lock
Application("msg") = msgNewCome
Application.UnLock()

Case "Send"

''会议是否结束
if(Application("MeetingStart")(Session("MeetingNo") - 1) = 0 )then
response.Redirect("welcome.asp")
end if
''发出信息
if(request("message") <> "" and vartype(request("message")) >=2)then
dim msgsend()
redim msgsend(Application("MeetingCount") - 1)
for i = 0 to Application("MeetingCount") - 1
msgsend(i) = Application("msg")(i)
next
'Application("submit")= Application("submit") + 1
msgsend(Session("MeetingNo") - 1) = cstr(time()) & "<font color=blue>" & " " & Session("Rname") & ": " & "</font>" & Server.htmlEncode(request("message")) & "<br>" & msgsend(Session("MeetingNo") - 1)
Application.lock
Application("msg")=msgsend
Application.unlock
end if



Case "Exit"
''此会议人数减1
dim MeetingManCountExit()
redim MeetingManCountExit(Application("MeetingCount") - 1)
for i = 0 to Application("MeetingCount") - 1
MeetingManCountExit(i) = Application("MeetingManCount")(i)
next
MeetingManCountExit( Session("MeetingNo") - 1 ) = MeetingManCountExit( Session("MeetingNo") - 1 ) - 1
Application.lock
Application("MeetingManCount") = MeetingManCountExit
Application.UnLock()

''退出会场提示
dim msgExit()
redim msgExit(Application("MeetingCount") - 1)
for i = 0 to Application("MeetingCount") - 1
msgExit(i) = Application("msg")(i)
next
msgExit(Session("MeetingNo") - 1) = cstr(time()) & "<font color=blue>" & " " & Session("Rname") & ":" & "</font>" & "<font color=red> 退出会场</font>" & "<br>" & msgExit(Session("MeetingNo") - 1)
Application.lock
Application("msg") = msgExit
Application.unlock

response.redirect("welcome.asp")


Case ELse

End Select
%>
<body leftmargin="0" topmargin="0" background="images/mainSkinBG.gif" OnLoad="SetFocus();">
<%''if(Application("MeetingStart") = 1) then %>
<table cellspacing="0" cellpadding="0" class=css2 width="100%" align="center" height="100%" bgcolor="#D9D491">
<form method="post" name= "form1" action="chat.asp">
<tr bgcolor="D9D491"><td align="right" valign="top" class="title" ><iframe name=chat frameborder="no" class=css0 width="100%" height="100%" src="chattext.asp"></iframe></td></tr>
<tr valign="top" bgcolor="D9D491">
<td height="25" align="left" valign="middle" > <b>我要发言</b>:
<input type="text" name="message" size="60" onkeydown="JavaScript:PressKey();">
<input type="hidden" name="op" value="" >
<input type="submit" name="Submit" value="发 言" accesskey="S" OnClick="vbscript:Document.all.form1.op.value='Send'"><font color="#FF0000">Alt+S</font>
<% if(Application("Meetinger")(Session("MeetingNo") - 1) = Session("Rname")) then %>
<input type="submit" name="Submit2" value="结束会议" class=css0 onclick="vbscript:Document.all.form1.op.value='EndMeeting'">
<%else%>
<input type="submit" name="Submit3" value="退 出" class=css0 OnClick="vbscript:Document.all.form1.op.value='Exit'">
<% end if %>
</td>
</tr>
</form>
</table>
<%'end if%>
</body>
</html>
<script language="javascript">
document.form1.op.value='';
</script>

...全文
138 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
starytx 2005-12-02
  • 打赏
  • 举报
回复
你把提交按钮的type设为submit,不要用那个回车提交表单的函数,如果有验证表单的函数就在form中添加onsubmit="return 验证函数;"
AVAmyZ 2005-12-02
  • 打赏
  • 举报
回复
直接在脚本里面做提交的动作得了,<input>就不要有submit的动作了。
goodoycg 2005-12-02
  • 打赏
  • 举报
回复
我怀疑是那个提交按钮正好有焦点,我一回车触发了二个事件!
goodoycg 2005-12-02
  • 打赏
  • 举报
回复
ybfqlyq(/*-YBFQ ResTarTing......-*\) (
问题是解决了
我好像只提交了一次啊
我在文本框中按回车时让表单提交一次啊,
另一次我又是怎样提交的呢?烦麻解释一下,我过会就结贴
masong_1978 2005-12-02
  • 打赏
  • 举报
回复
帮你up
goodoycg 2005-12-02
  • 打赏
  • 举报
回复
to ivee(ivee) ( )
我刚才试了下,好像还是会提交两次,真的不知道怎么搞的
ivee 2005-12-02
  • 打赏
  • 举报
回复
<input type="submit" name="Submit" value="发 言" accesskey="S" OnClick="vbscript:Document.all.form1.op.value='Send'">

改成

<input type="button" name="Submit" value="发 言" accesskey="S" OnClick="vbscript:Document.all.form1.op.value='Send' document.all.form1.submit()">
ybfqlyq 2005-12-02
  • 打赏
  • 举报
回复
<input type="text" name="message" size="60" onkeydown="JavaScript:PressKey();">
<input type="hidden" name="op" value="" >
<input type="submit" name="Submit" value="发 言" accesskey="S" OnClick="vbscript:Document.all.form1.op.value='Send'"><font color="#FF0000">Alt+S</font>
function PressKey()
{
if(window.event.keyCode==13)
{
document.form1.op.value='Send'
this.document.form1.submit();
// document.form1.Submit.Click();
}

}

那個函數你都已經提交啦。。你這邊又多了一個提交的動作。所以有兩個提交的動作了。

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧