JavaScript应用于asp开发场景

JavaScript应用于asp开发场景

JavaScript应用于asp开发场景

演示代码示例:

 <%Path="../"%>
<!--#include file="../../Inc/Conn.asp"-->
<!--#include file="../../Inc/Web_Safe.asp"-->
<!--#include file="../../Inc/Function.asp"-->
<!--#include file="../Web_Save.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>后台管理首页</title>
<link href="../style/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
Dim adminid,What,Up,style
adminid = Request.QueryString("adminid")
What = Request.QueryString("What")
Id = Request.QueryString("Id")
UpId = Request.QueryString("UpId")
style = Request.QueryString("style") Dim SClass,SBoard,SType
If adminid ="" Then
Call Show_Msg("请选择要设置权限管理员!","Admin_User.asp")
Else
Set Rsc =Conn.Execute("Select Web_Admin_Class,Web_Admin_Board,Web_Admin_Type From Web_Admin Where Web_Admin_Id="&adminid)
On Error Resume Next
If Not Rs.Eof Then SClass = Rsc("Web_Admin_Class")
SBoard = Rsc("Web_Admin_Board")
SType = Rsc("Web_Admin_Type")
End If
Set Rsc =Nothing End If Select Case style
Case "class" Call DoUp(Id,UpId,"Class")
Case "Board" Call DoUp(Id,UpId,"Board")
Case "Type" Call DoUp(Id,UpId,"Type")
End Select Sub DoUp(Id,UpId,style)
If UpId<0 Then
Call Show_Msg("已经到顶,不能再上移了!","?adminid="&adminid)
Else On Error Resume Next
SQL = "Update "&style&" set IsDesc="&UpId&" where "&style&"Id ="&Id
Set Rs = Conn.Execute(SQL)
Set Rs=Nothing
Response.Redirect("?adminid="&adminid)
End If
End Sub %>
<table width="99%" border="0" align=center cellpadding=3 cellspacing=1 bordercolor="#FFFFFF" bgcolor="#C4D8ED">
<tbody>
<tr>
<td height=23 colspan=2 id="table_bg_title"><span class="STYLE1"> 管理员管理 &gt; 权限管理</span></td>
</tr>
<tr>
<td height="30" align="left" class="plen">[<a href="Admin_Edit.asp" target="main"> 增加管理员 </a>] [ <a href="Admin_User.asp" target="main">管理员列表</a> ] </td>
</tr>
<tr>
<td bgcolor="#EEF7FD">
<form action="Admin_Sys_Save.asp" method="post" name="Doclass">
<table width="100%" border="0" align=center cellpadding=8 cellspacing=1 bordercolor="#FFFFFF" bgcolor="#C4D8ED" class="m_top_bottom"> <tr>
<td width="94%" colspan="3" align="left" class="td_bg">
</a> </span> 建设中</td>
</tr> <tr>
<td height=12 colspan="4" align="left" class="plen">
操作:
<input type="radio" name="check_class" id="chkAll" onClick="CheckAll();">
全选 <input type="radio" name="check_class" id="NotchkAll" onClick="unSelect();">
反选
<input name="submit" type='submit' value=' ' onClick="return ConfirmDel()" class="send_botton1">
<input type="reset" name="button4" id="button4" value=" " class="pic_botton1">
<input name="action" type="hidden" id="action" value="Do_Sys" />
<input name="Web_Admin_Id" type="hidden" id="Web_Admin_Id" value="<%=adminid%>" /> </td>
</tr>
</table>
</form> </td>
</tr>
</table> </body>
</html>
<script language="javascript">
function unselectall(){
if(document.del.chkAll.checked){
document.del.chkAll.checked = document.del.chkAll.checked;
}
} function CheckAll1(form){ for (var i=0;i<form.elements.length;i++){
var e = form.elements[i];
if (e.Name != "chkAll"){
e.checked = form.chkAll.checked;
}
}
} function CheckAll(){
for(var i=0;i<document.Doclass.classid.length;i++){
document.Doclass.classid[i].checked=true;
}
for(var i=0;i<document.Doclass.Typeid.length;i++){
document.Doclass.Typeid[i].checked=true;
}
for(var i=0;i<document.Doclass.Boardid.length;i++){
document.Doclass.Boardid[i].checked=true;
}
} function unSelect(){ for(var i=0;i<document.Doclass.classid.length;i++) {
if(document.Doclass.classid[i].checked)
{
document.Doclass.classid[i].checked=false;
} else {
document.Doclass.classid[i].checked=true;
}
}
//
for(var i=0;i<document.Doclass.Boardid.length;i++) {
if(document.Doclass.Boardid[i].checked)
{
document.Doclass.Boardid[i].checked=false;
} else {
document.Doclass.Boardid[i].checked=true;
}
}
//
for(var i=0;i<document.Doclass.Typeid.length;i++) {
if(document.Doclass.Typeid[i].checked)
{
document.Doclass.Typeid[i].checked=false;
} else {
document.Doclass.Typeid[i].checked=true;
}
}
//
}
////////////////////////
function ConfirmDel()
{
if(confirm("确定要提交吗?"))
return true;
else
return false;
}
</script>
05-02 08:38