当前位置: 代码迷 >> ASP >> 一个页面,两提交按钮,事件代码如何写
  详细解决方案

一个页面,两提交按钮,事件代码如何写

热度:196   发布时间:2012-02-25 10:01:49.0
一个页面,两提交按钮,事件代码怎么写?
<form   name= "form1 "     method= "post "   action= "chkmsg.asp ">

//   表中审核状态数据项名为lock,默认是未审核

<input   type= "submit "   name= "checked "   value= "通过审核 ">   //将lock更改为已审核
<input   type= "submit "   name= "unchecked "   value= "取消审核 "> //将lock改为未审核

之前我只有“通过审核”这个按钮,通过提交后交给chkmsg.asp处理将数据集中的lock字段改为 "已审核 "而达到审核的目的

我现在想也通过“取消审核”   将已经审核的记录中的lock字段值改为 "未审核 "状态..

该怎么做啊??

------解决方案--------------------
<form name= "form1 " method= "post " action= " ">
<input type= "submit " name= "checked " value= "通过审核 " onclick= "javascript:this.form1.action= 'window.location=chkmsg.asp?lock=1 ';this.form1.submit(); ">
<input type= "submit " name= "unchecked " value= "取消审核 " onclick= "javascript:this.form1.action= 'window.location=chkmsg.asp?lock=0 ';this.form1.submit(); "> > //将lock改为未审核

chkmsg.asp页中接Lock=Request.QueryString( "lock ")

------解决方案--------------------
<script>
function dosubmit(n){
var f = document.form1;
f.state = n;
f.submit();
}
</script>
<form name= "form1 " method= "post " action= "chkmsg.asp ">
<input type= "button " name= "checked " value= "通过审核 " onclick= "dosubmit(1); ">
<input type= "button " name= "unchecked " value= "取消审核 " onclick= "dosubmit(0); ">
<input type= "hidden " name= "state ">
...

chkmsg.asp里

state = CInt(Request.Form( "state "))
If state = 0 Then
sql = 取消审核
Else
sql = 已审核
End If


------解决方案--------------------
<form name= "form1 " method= "post " action= " ">

<input type= "button " name= "checked " value= "通过审核 " onclick=submitform(this.value)> //将lock更改为已审核
<input type= "button " name= "unchecked " value= "取消审核 " onclick=submitform(this.value)> //将lock改为未审核


<script language=vbscript>
sub submitform(v)
select case v
case "通过审核 "
form1.action= ".... " //通过审核的页面
case "取消审核 "
form1.action= ".... " //取消审核的页面
end select
form1.submit
end sub
</script>
------解决方案--------------------
<form name= "form1 " method= "post " action= "chkmsg.asp ">
<input type= "button " name= "checked " value= "通过审核 " onclick= "dosubmit(1); ">
<input type= "button " name= "unchecked " value= "取消审核 " onclick= "dosubmit(0); ">
</form>


if Request( "unchecked ") = "取消审核 " then
'取消审核
'...
else
'审核
'...
end if
  相关解决方案