提交表单后,怎么设置弹窗提示?

shugeer 2011-10-28 10:34:15
我是asp新手,大家不要笑我,如下代码,代码是没有问题的,只是提交表单成功后不知道怎么设置弹窗提示"已设置成功"?



<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用戶權限管理 UserRightsManagement</title>
<!--#include file="../Connections/conn.asp" -->
<!--#include file="../Connections/connopen.asp" -->
<%
i = 0
set rst=Server.CreateObject("adodb.recordset")
sql="select * from e_users where u_id='"&Trim(Request.QueryString("u_id"))&"'"
rst.open sql,conn,1,1




If (CStr(Request("insert")) = "form1") Then

u_id=Trim(Request.QueryString("u_id"))
set rst3=server.CreateObject("adodb.recordset")
sql3="select * from e_item "
rst3.open sql3,conn,1,1

do while not rst3.eof
i_id=rst3("i_id")
p_add=request("p_add"&i_id)

if p_add="" then p_add=0 else p_add=1 end if
p_edit=request("p_edit"&i_id)
if p_edit="" then p_edit=0 else p_edit=1 end if
p_invalid=request("p_invalid"&i_id)
if p_invalid="" then p_invalid=0 else p_invalid=1 end if
p_view=request("p_view"&i_id)
if p_view="" then p_view=0 else p_view=1 end if

set rst4=server.CreateObject("adodb.recordset")
sql4="select * from e_itempermissions where u_id="&u_id&" and i_id="&i_id&" "
rst4.open sql4,conn,1,1

if rst4.recordcount>0 then
sql="update e_itempermissions set p_add="&p_add&",p_edit="&p_edit&" ,p_invalid="&p_invalid&" ,p_view="& p_view&" where u_id="&u_id&" and i_id="&i_id&" "
' response.Write(sql)
' response.end
conn.execute sql


else
sql="insert into e_itempermissions (u_id,i_id,p_add,p_edit,p_invalid,p_view) values ("&u_id&","&i_id&","&p_add&","&p_edit&","&p_invalid&","&p_view&")"
' response.Write(sql)
'response.end
conn.execute sql
end if

Response.Flush
rst3.movenext
loop


rst3.close
set rst3=nothing
rst4.close
set rst4=nothing
end if
%>
</head>

<body>
<form id="form1" name="form1" method="post" action="<%=MM_editAction%>">
<table width="528" height="304" border="1" cellpadding="0" cellspacing="0">
<tr>
<td colspan="4">用戶權限管理</td>
</tr>
<tr>
<td width="60">姓名</td>
<td width="176"><label for="u_name"></label>
<input name="u_name" type="text" id="u_name" value="<%=rst("u_name")%>"/></td>
<td width="86">成本中心</td>
<td width="196"><input type="text" name="Costcenter" id="Costcenter" value="<%=rst("Costcenter")%>"/></td>
</tr>
<%


set rst1=Server.createObject("adodb.recordset")
sql1="select a.*,isnull(P_add,0) P_add,isnull(p_edit,0) p_edit ,isnull(P_view,0) P_view," & _
" isnull(p_invalid,0) p_invalid ,b.p_id from e_item a left join e_itempermissions b " & _
" on a.i_id=b.i_id and b.u_id='"&Trim(Request.QueryString("u_id"))&"' "


rst1.open sql1,conn,1,1

i=1
do while not rst1.eof
%>

<tr>
<td><%=rst1("i_item")%>
</td>
<td colspan="3">

<input <% if ( CStr(rst1("p_add")) = CStr("1") ) Then Response.Write("checked=""checked""") : Response.Write("") %> name="p_add<%=rst1("i_id")%>" type="checkbox" id="p_add<%=rst1("i_id")%>" value="1" />
新增
   
<input <% if (cstr(rst1("p_edit"))=CStr("1")) then response.write("checked=""checked""") : response.write("") %> name="p_edit<%=rst1("i_id")%>" type="checkbox" id="p_edit<%=rst1("i_id")%>" value="1" />
修改
   
<input <% if (CStr(rst1("p_invalid"))=Cstr("1")) then response.write("checked=""checked""") : response.write("") %> name="p_invalid<%=rst1("i_id")%>" type="checkbox" id="p_invalid<%=rst1("i_id")%>" value="1" />
作廢
   
<input <% if (CStr(rst1("p_view"))=CStr("1")) then response.write("checked=""checked""") : response.write("") %> name="p_view<%=rst1("i_id")%>" type="checkbox" id="p_view<%=rst1("i_id")%>" value="1" />
查詢

</td>
</tr>
<% i=i+1
Response.Flush
rst1.movenext

loop
'end if
%>
<tr>
<td colspan="4"><input type="submit" name="button" id="button" value="提交" />
<input type="reset" name="button2" id="button2" value="重置" />
<input name="zs" type="hidden" id="zs" value="<%=i-1%>" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<input type="hidden" name="insert" value="form1" />
</form>
</body>
</html>
<%
rst.close
set rst=nothing
%>
...全文
927 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
秋的红果实 2011-10-29
  • 打赏
  • 举报
回复
web程序和form的就是不一样,web的不要用弹出窗口,浏览器会拦截(客户看不到提示窗口)
你在当前页面的某个地方提示不就行了,改成下面的样子
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用戶權限管理 UserRightsManagement</title>
<!--#include file="../Connections/conn.asp" -->
<!--#include file="../Connections/connopen.asp" -->
<%
i = 0
set rst=Server.CreateObject("adodb.recordset")
sql="select * from e_users where u_id='"&Trim(Request.QueryString("u_id"))&"'"
rst.open sql,conn,1,1




If (CStr(Request("insert")) = "form1") Then

u_id=Trim(Request.QueryString("u_id"))
set rst3=server.CreateObject("adodb.recordset")
sql3="select * from e_item "
rst3.open sql3,conn,1,1

do while not rst3.eof
i_id=rst3("i_id")
p_add=request("p_add"&i_id)

if p_add="" then p_add=0 else p_add=1 end if
p_edit=request("p_edit"&i_id)
if p_edit="" then p_edit=0 else p_edit=1 end if
p_invalid=request("p_invalid"&i_id)
if p_invalid="" then p_invalid=0 else p_invalid=1 end if
p_view=request("p_view"&i_id)
if p_view="" then p_view=0 else p_view=1 end if

set rst4=server.CreateObject("adodb.recordset")
sql4="select * from e_itempermissions where u_id="&u_id&" and i_id="&i_id&" "
rst4.open sql4,conn,1,1

if rst4.recordcount>0 then
sql="update e_itempermissions set p_add="&p_add&",p_edit="&p_edit&" ,p_invalid="&p_invalid&" ,p_view="& p_view&" where u_id="&u_id&" and i_id="&i_id&" "
' response.Write(sql)
' response.end
conn.execute sql


else
sql="insert into e_itempermissions (u_id,i_id,p_add,p_edit,p_invalid,p_view) values ("&u_id&","&i_id&","&p_add&","&p_edit&","&p_invalid&","&p_view&")"
' response.Write(sql)
'response.end
conn.execute sql
end if

Response.Flush
rst3.movenext
loop

dim tishi
tishi="已设置成功"


rst3.close
set rst3=nothing
rst4.close
set rst4=nothing
end if
%>
</head>

<body>
<form id="form1" name="form1" method="post" action="<%=MM_editAction%>">
<table width="528" height="304" border="1" cellpadding="0" cellspacing="0">
<tr>
<td colspan="4">用戶權限管理</td>
</tr>
<tr>
<td width="60">姓名</td>
<td width="176"><label for="u_name"></label>
<input name="u_name" type="text" id="u_name" value="<%=rst("u_name")%>"/></td>
<td width="86">成本中心</td>
<td width="196"><input type="text" name="Costcenter" id="Costcenter" value="<%=rst("Costcenter")%>"/></td>
</tr>
<%


set rst1=Server.createObject("adodb.recordset")
sql1="select a.*,isnull(P_add,0) P_add,isnull(p_edit,0) p_edit ,isnull(P_view,0) P_view," & _
" isnull(p_invalid,0) p_invalid ,b.p_id from e_item a left join e_itempermissions b " & _
" on a.i_id=b.i_id and b.u_id='"&Trim(Request.QueryString("u_id"))&"' "


rst1.open sql1,conn,1,1

i=1
do while not rst1.eof
%>

<tr>
<td><%=rst1("i_item")%>
</td>
<td colspan="3">

<input <% if ( CStr(rst1("p_add")) = CStr("1") ) Then Response.Write("checked=""checked""") : Response.Write("") %> name="p_add<%=rst1("i_id")%>" type="checkbox" id="p_add<%=rst1("i_id")%>" value="1" />
新增
   
<input <% if (cstr(rst1("p_edit"))=CStr("1")) then response.write("checked=""checked""") : response.write("") %> name="p_edit<%=rst1("i_id")%>" type="checkbox" id="p_edit<%=rst1("i_id")%>" value="1" />
修改
   
<input <% if (CStr(rst1("p_invalid"))=Cstr("1")) then response.write("checked=""checked""") : response.write("") %> name="p_invalid<%=rst1("i_id")%>" type="checkbox" id="p_invalid<%=rst1("i_id")%>" value="1" />
作廢
   
<input <% if (CStr(rst1("p_view"))=CStr("1")) then response.write("checked=""checked""") : response.write("") %> name="p_view<%=rst1("i_id")%>" type="checkbox" id="p_view<%=rst1("i_id")%>" value="1" />
查詢

</td>
</tr>
<% i=i+1
Response.Flush
rst1.movenext

loop
'end if
%>
<tr>
<td colspan="4"><input type="submit" name="button" id="button" value="提交" />
<input type="reset" name="button2" id="button2" value="重置" />
<input name="zs" type="hidden" id="zs" value="<%=i-1%>" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>

<tr><td><%=tishi%></td></tr>

</table>
<input type="hidden" name="insert" value="form1" />
</form>
</body>
</html>
<%
rst.close
set rst=nothing
%>

我只是给你举个例子,在哪里设置变量tishi的值,以及要在哪里显示tishi的值,要具体看你的程序功能了
butcher2002 2011-10-29
  • 打赏
  • 举报
回复


rst3.close
set rst3=nothing
rst4.close
set rst4=nothing
end if
Response.Write"<script>alert('更新成功!');</SCRIPT>"
%>
shugeer 2011-10-29
  • 打赏
  • 举报
回复
问题这句是在哪里加呀?再加20分
yyisong998 2011-10-29
  • 打赏
  • 举报
回复
Response.Write"<script>alert('更新成功!');location.href='***.asp'</SCRIPT>"
t1ke2 2011-10-28
  • 打赏
  • 举报
回复
有点迷糊。。。
shugeer 2011-10-28
  • 打赏
  • 举报
回复
顶~~~