JavaScript应用于asp开发场景
演示代码示例:
代码语言:javascript复制 1 <%Path="../"%>
2 <!--#include file="../../Inc/Conn.asp"-->
3 <!--#include file="../../Inc/Web_Safe.asp"-->
4 <!--#include file="../../Inc/Function.asp"-->
5 <!--#include file="../Web_Save.asp"-->
6 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
7 <html xmlns="http://www.w3.org/1999/xhtml">
8 <head>
9 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
10 <title>后台管理首页</title>
11 <link href="../style/style.css" rel="stylesheet" type="text/css">
12 </head>
13 <body>
14 <%
15 Dim adminid,What,Up,style
16 adminid = Request.QueryString("adminid")
17 What = Request.QueryString("What")
18 Id = Request.QueryString("Id")
19 UpId = Request.QueryString("UpId")
20 style = Request.QueryString("style")
21
22 Dim SClass,SBoard,SType
23 If adminid ="" Then
24 Call Show_Msg("请选择要设置权限管理员!","Admin_User.asp")
25 Else
26 Set Rsc =Conn.Execute("Select Web_Admin_Class,Web_Admin_Board,Web_Admin_Type From Web_Admin Where Web_Admin_Id="&adminid)
27 On Error Resume Next
28 If Not Rs.Eof Then
29
30 SClass = Rsc("Web_Admin_Class")
31 SBoard = Rsc("Web_Admin_Board")
32 SType = Rsc("Web_Admin_Type")
33 End If
34 Set Rsc =Nothing
35
36
37 End If
38
39 Select Case style
40 Case "class" Call DoUp(Id,UpId,"Class")
41 Case "Board" Call DoUp(Id,UpId,"Board")
42 Case "Type" Call DoUp(Id,UpId,"Type")
43 End Select
44
45
46 Sub DoUp(Id,UpId,style)
47 If UpId<0 Then
48 Call Show_Msg("已经到顶,不能再上移了!","?adminid="&adminid)
49 Else
50
51 On Error Resume Next
52 SQL = "Update "&style&" set IsDesc="&UpId&" where "&style&"Id ="&Id
53 Set Rs = Conn.Execute(SQL)
54 Set Rs=Nothing
55 Response.Redirect("?adminid="&adminid)
56 End If
57 End Sub
58
59 %>
60 <table width="99%" border="0" align=center cellpadding=3 cellspacing=1 bordercolor="#FFFFFF" bgcolor="#C4D8ED">
61 <tbody>
62 <tr>
63 <td height=23 colspan=2 id="table_bg_title"><span class="STYLE1"> 管理员管理 > 权限管理</span></td>
64 </tr>
65 <tr>
66 <td height="30" align="left" class="plen">[<a href="Admin_Edit.asp" target="main"> 增加管理员 </a>] [ <a href="Admin_User.asp" target="main">管理员列表</a> ] </td>
67 </tr>
68 <tr>
69 <td bgcolor="#EEF7FD">
70 <form action="Admin_Sys_Save.asp" method="post" name="Doclass">
71 <table width="100%" border="0" align=center cellpadding=8 cellspacing=1 bordercolor="#FFFFFF" bgcolor="#C4D8ED" class="m_top_bottom">
72
73 <tr>
74 <td width="94%" colspan="3" align="left" class="td_bg">
75 </a> </span> 建设中</td>
76 </tr>
77
78 <tr>
79 <td height=12 colspan="4" align="left" class="plen">
80 操作:
81 <input type="radio" name="check_class" id="chkAll" onClick="CheckAll();">
82 全选
83
84 <input type="radio" name="check_class" id="NotchkAll" onClick="unSelect();">
85 反选
86 <input name="submit" type='submit' value=' ' onClick="return ConfirmDel()" class="send_botton1">
87 <input type="reset" name="button4" id="button4" value=" " class="pic_botton1">
88 <input name="action" type="hidden" id="action" value="Do_Sys" />
89 <input name="Web_Admin_Id" type="hidden" id="Web_Admin_Id" value="<%=adminid%>" /> </td>
90 </tr>
91 </table>
92 </form> </td>
93 </tr>
94 </table>
95
96 </body>
97 </html>
98 <script language="javascript">
99 function unselectall(){
100 if(document.del.chkAll.checked){
101 document.del.chkAll.checked = document.del.chkAll.checked;
102 }
103 }
104
105 function CheckAll1(form){
106
107 for (var i=0;i<form.elements.length;i ){
108 var e = form.elements[i];
109 if (e.Name != "chkAll"){
110 e.checked = form.chkAll.checked;
111 }
112 }
113 }
114
115 function CheckAll(){
116 for(var i=0;i<document.Doclass.classid.length;i ){
117 document.Doclass.classid[i].checked=true;
118 }
119 for(var i=0;i<document.Doclass.Typeid.length;i ){
120 document.Doclass.Typeid[i].checked=true;
121 }
122 for(var i=0;i<document.Doclass.Boardid.length;i ){
123 document.Doclass.Boardid[i].checked=true;
124 }
125 }
126
127 function unSelect(){
128
129 for(var i=0;i<document.Doclass.classid.length;i ) {
130 if(document.Doclass.classid[i].checked)
131 {
132 document.Doclass.classid[i].checked=false;
133 } else {
134 document.Doclass.classid[i].checked=true;
135 }
136 }
137 //
138 for(var i=0;i<document.Doclass.Boardid.length;i ) {
139 if(document.Doclass.Boardid[i].checked)
140 {
141 document.Doclass.Boardid[i].checked=false;
142 } else {
143 document.Doclass.Boardid[i].checked=true;
144 }
145 }
146 //
147 for(var i=0;i<document.Doclass.Typeid.length;i ) {
148 if(document.Doclass.Typeid[i].checked)
149 {
150 document.Doclass.Typeid[i].checked=false;
151 } else {
152 document.Doclass.Typeid[i].checked=true;
153 }
154 }
155 //
156 }
157 ////////////////////////
158 function ConfirmDel()
159 {
160 if(confirm("确定要提交吗?"))
161 return true;
162 else
163 return false;
164 }
165 </script>