⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shengcity.asp

📁 创建和运行动态、交互的Web服务器应用程序
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<!--#include file="conn.asp"-->
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../images/css2.css" rel="stylesheet" type="text/css">
<script LANGUAGE="javascript">
<!--
function regInput(obj, reg, inputStr)
{
  var docSel	= document.selection.createRange()
  if (docSel.parentElement().tagName != "INPUT")	return false
  oSel = docSel.duplicate()
  oSel.text = ""
  var srcRange	= obj.createTextRange()
  oSel.setEndPoint("StartToStart", srcRange)
  var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
  return reg.test(str)
 }
//-->
</script>
</head>
<body>

<%'//变量及数据的处理(删、修、添)

dim action,songid,cityid,skey,ckey,shengid,sori,page,i,ci,ii,rs1,i_mun,i_color

cityid =request.QueryString("cid")
shengid=request.QueryString("sid")
action =request.QueryString("action")
set rs=server.CreateObject("adodb.recordset")

select case action

'/////删除省份
      case "shengdel"
conn.execute "delete from shop_sheng where shengid="&shengid
conn.execute "delete from shop_city  where shengid="&shengid
response.redirect "shengcity.asp?action=sheng"

'/////修改省份
      case "shengsave"
rs.open "select * from shop_sheng where shengid="&shengid,conn,1,3
if request("shengidorder")="" or request("shengname")="" then
   response.write "<script language=javascript>alert('排序不能或省份名不能为空!');window.location.reload('shengcity.asp?action=sheng')</script>"
else
   rs("shengidorder")=request("shengidorder")
   rs("shengname")   =request("shengname")
   rs.update
   rs.close
   response.write "<script language=javascript>alert('成功修改了省份资料!');window.location.reload('shengcity.asp?action=sheng')</script>"
   response.End
end if 

'/////添加省份
      case "shengadd"
rs.open "select * from shop_sheng",conn,1,3
if request("shengidorder")="" or trim(request("shengname")) ="" then
   response.write "<script language=javascript>alert('输入的信息不完整!');window.location.reload('shengcity.asp?action=sheng')</script>"
else
   rs.addnew
   rs("shengname")=trim(request("shengname"))
   rs("shengidorder")=request("shengidorder")
   rs.update
   rs.close
   response.write "<script language=javascript>window.location.reload('shengcity.asp?action=sheng')</script>"
  response.End
end if 

'/////删除城区
      case "citydel"
conn.execute "delete from shop_city where cityid="&cityid
response.redirect "shengcity.asp?action=city"

'/////修改城区
      case "citysave"
rs.open "select * from shop_city where cityid="&cityid,conn,1,3
if request("cityname")="" then
   response.write "<script language=javascript>alert('请输入城区名称!');window.location.reload('shengcity.asp?action=city')</script>"
else
rs("shengid")=request("shengid")
rs("cityname")=request("cityname")
rs("faid")=request("faid")
rs.update
rs.close
response.write "<script language=javascript>alert('成功修改城区资料!');window.location.reload('shengcity.asp?action=city')</script>"
response.End
end if

'/////添加城区
      case "cityadd"
rs.open "select * from shop_city",conn,1,3
if trim(request("cityname"))=""  then
   response.write "<script language=javascript>alert('请输入城区名称!');window.location.reload('shengcity.asp?action=city')</script>"
else
   rs.addnew
   rs("cityname")=trim(request("cityname"))
   rs("cityidorder")=trim(request("cityidorder"))
   rs("shengid")=request("shengid")
   rs("faid")=request("faid")
   rs.update
   rs.close
   response.write "<script language=javascript>window.location.reload('shengcity.asp?action=city')</script>"
   response.End
end if

end select
set rs=nothing
%>

<table width="90%"  border="0" height=450 cellpadding="0" cellspacing="0">
  <tr><td bgcolor="#ece9d8"><br>
     <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr><td>
         
          <table width=231  border="0"  cellpadding="0" cellspacing="0">
            <tr valign=bottom><% select case action
                                        case "sheng"%>
              <td background=images/get_img.gif  width=77 height=26><P style='PADDING-LEFT: 7px'><div align="center"><font color=#ffffff>省份管理</font></div></td>
              <td background=images/lose_img.gif width=77 height=26><P style='PADDING-LEFT: 7px'><div align="center"><a href="shengcity.asp?action=city"><font color=#000000>城区管理</font></a></div></td>
              <td background=images/lose_img.gif width=77 height=26><P style='PADDING-LEFT: 7px'><div align="center"><font color=#000000>查询结果</font></div></td><%
                                        case "city"%>
              <td background=images/lose_img.gif width=77 height=26><P style='PADDING-LEFT: 7px'><div align="center"><a href="shengcity.asp?action=sheng"><font color=#000000>省份管理</font></a></div></td>
              <td background=images/get_img.gif  width=77 height=26><P style='PADDING-LEFT: 7px'><div align="center"><font color=#ffffff>城区管理</font></div></td>
              <td background=images/lose_img.gif width=77 height=26><P style='PADDING-LEFT: 7px'><div align="center"><font color=#000000>查询结果</font></div></td><%
                                        case   else%>
              <td background=images/lose_img.gif width=77 height=26><P style='PADDING-LEFT: 7px'><div align="center"><a href="shengcity.asp?action=sheng"><font color=#000000>省份管理</font></a></div></td>
              <td background=images/lose_img.gif width=77 height=26><P style='PADDING-LEFT: 7px'><div align="center"><a href="shengcity.asp?action=city" ><font color=#000000>城区管理</font></a></div></td>
              <td background=images/get_img.gif  width=77 height=26><P style='PADDING-LEFT: 7px'><div align="center"><font color=#ffffff>查询结果</font></div></td><%
                                  end select%> 
              
            </tr>
          </table>



<%'//界面的设计(查、显、添)

select case action

       case "sheng" '//省界面的设计(查、显、添)%>
<table width="100%" border="1"  align=center cellspacing="0" cellpadding="0" bordercolordark="#ffffff" bordercolorlight="#666666">
   <form name="form1" method="post" action="shengcity.asp?action=chekskey">
    <tr>
       <td colspan=2 bgcolor="#cccccc" height=28><div align="center">输入查询省份名称&nbsp;<input name="skey" type="text" class="tx" id="skey" size="14">&nbsp;<input type="submit" name="Submit32" class="bt5" value="查 询"></div></td>
    </tr>   
  </form>
    <tr>
       <td width="70%" valign=top>

   <table width="100%" border="1"  align=center cellspacing="0" cellpadding="0">
    <tr>
       <td><table width="100%" border="0"  align=center cellspacing="0" cellpadding="0" bgcolor="#ffffff">
       <td bgcolor="#ece9d8"><div align="center">排 序</div></td> 
       <td bgcolor="#ece9d8"><div align="center">省份名称</div></td>
       <td bgcolor="#ece9d8"><div align="center">编辑</div></td> 
       <td bgcolor="#ece9d8"><div align="center">删除</div></td>
    </tr>
        <%
          set rs=server.CreateObject("adodb.recordset")
              rs.open "select * from shop_sheng order by shengidorder",conn,1,1
         sori=rs.recordcount  
	  Page = rs.AbsolutePage	 
          page=1:i=0:i_mun=1
          rs.PageSize = 10 
          if Not IsEmpty(Request("Page")) then 
             Page = CInt(Request("Page")) 
             if Page > rs.PageCount then 
                rs.AbsolutePage = rs.PageCount 
             elseif Page <= 0 then 
                Page = 1 
             else
               rs.AbsolutePage = Page 
             end if
          else
             Page = 1
          end if
         
          For i = 1 to rs.PageSize
              if rs.EOF then     
                 Exit For 
              end if
              if i_mun mod 2=1 then 
                 i_color="#ffffff"
              else
                 i_color="#eeeeee"
              end if
         %>
      <tr> 
        <form name="form1" method="post" action="shengcity.asp?action=shengsave&sid=<%=rs("shengid")%>">
          <td bgcolor=<%=i_color%>><div align="center"> 
                <input name="shengidorder" type="text" id="shengidorder" size="2" value=<%=rs("shengidorder")%> onkeypress	= "return regInput(this,	/^[0-9]*$/,		String.fromCharCode(event.keyCode))"
		onpaste		= "return regInput(this,	/^[0-9]*$/,		window.clipboardData.getData('Text'))"
		ondrop		= "return regInput(this,	/^[0-9]*$/,		event.dataTransfer.getData('Text'))"></div></td>
          <td bgcolor=<%=i_color%>><div align="center">
                <input name="shengname"    type="text" id="shengname"    size="8" value=<%=trim(rs("shengname"))%>></div></td> 
          <td bgcolor=<%=i_color%>><div align="center"> 
                <input type="submit" name="Submit2" class="bt" value="确认">
           <td bgcolor=<%=i_color%>><div align="center">
                <a href="shengcity.asp?action=shengdel&sid=<%=rs("shengid")%>" onClick="return confirm('您确定进行删除操作吗?')"><font color="#FF0000">删除</font></a> </div></td>
        </form>
     </tr>
        <%i_mun=i_mun+1
          rs.movenext
                 next
	%>
   
      <tr> 
         <td colspan=4 bgcolor="#ece9d8" height=40><div align="center">省份共<%=rs.recordcount%>条<%=rs.pagecount%>页 
           <%if request("page")>1 then%>
                <a Href="index.asp?Page=<%=1%>">首页</a>&nbsp;&nbsp;<a Href="shengcity.asp?action=sheng&Page=<%=page-1%>">上一页</a>
           <%end if %>
           <%if request("page")<>rs.pagecount and page<rs.pagecount then %>
                <a Href="shengcity.asp?action=sheng&Page=<% =page + 1%>">下一页</a>&nbsp;&nbsp;<a Href="shengcity.asp?action=sheng&Page=<%=rs.PageCount%>">尾页</a> 
           <%end if
             if rs.pagecount>0 then %>
                当前第<font color="#FF3300"><%=page%></font>页		
           <%end if%></font></div></td>
    
      </tr>
    </table>

   </tr>
  </table>

    <td valign=top>

    <table width="100%" border="1"  align=center cellspacing="0" cellpadding="0" bgcolor="#cccccc">
       <form name="form1" method="post" action="shengcity.asp?action=shengadd">
            <tr><td colspan=2 bgcolor="#ece9d8"><div align="center"><b>增加省份</b></div></td>
            <tr>
               <td bgcolor="#ffffff"><div align="right">省份
               <td bgcolor="#ffffff"><input name="shengname" type="text" id="shengname" size="14">
            <tr>
               <td bgcolor="#ffffff"><div align="right">排序
               <td bgcolor="#ffffff"><input name="shengidorder" type="text" id="shengidorder" value=<%=sori+1%> size="10" onkeypress	= "return regInput(this,	/^[0-9]*$/,		String.fromCharCode(event.keyCode))"
		onpaste		= "return regInput(this,	/^[0-9]*$/,		window.clipboardData.getData('Text'))"
		ondrop		= "return regInput(this,	/^[0-9]*$/,		event.dataTransfer.getData('Text'))">
           <tr><td colspan=2><div align="center"><input type="submit" name="Submit32" class="bt5" value="添 加"></div></td>
         </form>
     </tr>
    </table>
 
<%rs.close

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -