url.asp

来自「OFFICE办公自动化」· ASP 代码 · 共 202 行

ASP
202
字号
<%
'文件名:url.asp
'作者:唐小刚
'功能:常用网址管理
'参数:
'开发时间:2002.12.10
%>
<!--#include file="../inc/Secure.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/Const.asp"-->
<%
'变量申明区
dim RsRo'流程查询结果集
dim RsRe'流程查询处理结果集
dim SqlRo'查询字符串
dim message'消息处理
dim i'列表隔
%>
<%
SqlRo="select * from tbioaurl"
set RsRo=server.createobject("adodb.recordset")
RsRo.open SqlRo,oconn,1,3

'添加
set RsRe=server.createobject("adodb.recordset")
if(Request("mode")="add") then
  '检查是否该标题已存在
  SqlRo="select * from tbioaurl where urlname='"&trim(crequest("title"))&"'"
  RsRe.open SqlRo,oconn,1,3
  if(not  RsRe.eof) then 
    message="对不起,该网址名存在"
  else
    SqlRo="Insert into tbioaurl(urlname,urlhttp) values('"&trim(crequest("title"))&"','"&trim(crequest("url"))&"')"
    oConn.Execute(SqlRo)
	message="网址加成功"
  end if
'修改
elseif(Request("mode")="edit") then
  if(request("id")<>"") then
    SqlRo="update tbioaurl set urlname='" &trim(crequest("title")) & "',urlhttp='"&trim(crequest("url"))&"' where urlid=" & request("id")
    oConn.Execute(SqlRo)
    message="修改成功"
  end if
'删除
elseif(Request("mode")="del") then
  SqlRo="delete from tbioaurl where urlid=" &request("id")
  oConn.Execute(SqlRo)
  message="删除成功"
end if
%>


<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/main.css" type=text/css>
<title>main</title>
<base target="FrmMain">
<script src="../js/Popup.js"></script>
<script src="../js/front_chec.js"></script>
<script language="JavaScript">
<!--
 function require(form)
 {
	return checnull(form.Title,"请填写网址名!")
 }
 function edit(id,str,tulr)
 {
   document.frm.Title.value=str
   document.frm.url.value=tulr
   document.frm.mode.value="edit"
   document.frm.id.value=id
   this.location="#bottom"
 }
 function del(id)
 {
   if(confirm("确信删除该网址名吗?"))
   {
     window.navigate("url.asp?mode=del&id="+id)
   }
 }
-->
</script>
</head>

<body topmargin="10" leftmargin="10">
<hr width="100%" size=1 color="#000000">
<center>
  <table width="66%" cellspacing="1" cellpadding="2" class="tab">
    <tr> 
      <td width="209" class="tdTop">网址名称</td>
      <td width="297" class="tdTop">网址 </td>
      <td width="61" class="tdTop">修改</td>
      <td width="63" class="tdTop">删除</td>
    </tr>
<%
i=0
do while not RsRo.eof and not RsRo.bof
if i mod 2 = 0 then td_class="td1" else td_class="td2"
%>
    <tr> 
      <td height="25" class="<%=td_class%>" width="209"><%=trim(RsRo("urlname"))%></td>
      <td class="<%=td_class%>" width="297"><%=trim(RsRo("urlhttp"))%>&nbsp;</td>
      <td class="<%=td_class%>" width="61"><a href="javascript:edit('<%=RsRo("urlid")%>','<%=replace(RsRo("urlname"),"'","\'")%>','<%=replace(RsRo("urlhttp"),"'","\'")%>')" >修改</a></td>
      <td class="<%=td_class%>" width="63"><a href="javascript:del('<%=RsRo("urlid")%>')">删除</a></td>
    </tr>
<%
i=i+1
RsRo.movenext
loop
%>
  </table>
</center>
<br>

<div align="center">
<table width="400" cellspacing="1" cellpadding="2" class="tab">
  <tr>
    <td width="100%" class="tdTop">
      <table border="0" width="100%" cellspacing="0" cellpadding="0">
        <tr>
            <td class="tdTop"> <p align="left"><img border="0" src="../images/icon_title.gif" align="left">网址名定义</p>
          </td>
        </tr>
      </table>
    </td>
  </tr>
    <tr> 
      <td width="25%" valign="top" class="td1">
<form name="eventfrm" method="POST" action="../service/url.asp" onSubmit="return require(this)">
<input type="hidden" name="mode" value="add">
          <table border="0" width="100%" cellspacing="10" cellpadding="0">
            <tr> 
              <td width="100%" height="11">网址标题: 
                <input type="text" name="Title" size="30" maxlength="100" class="input"> 
                <font COLOR="RED">*</font> </td>
            </tr>
            <tr>
              <td height="12">网址:  
                <input name="url" type="text" class="input" id="url" size="30" maxlength="100"></td>
            </tr>
            <tr> 
              <td width="100%"> <div align="center"> 
                  <input type="submit" value="添加" name="B1" class="button0" onmouseout=className="button0" onmouseover=className="button1">
                    
                  <input type="reset" value="重写" name="B2" class="button0" onmouseout=className="button0" onmouseover=className="button1">
                </div></td>
            </tr>
          </table>
    </form>
      </td>
  </tr>
  <tr>
    <td width="25%" class="tdBottom">
    </td>
  </tr>
</table>
<p>&nbsp;</p><table width="400" cellspacing="1" cellpadding="2" class="tab">
    <tr> 
      <td width="100%" class="tdTop"> <table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr> 
            <td class="tdTop"> <p align="left"><img border="0" src="../images/icon_title.gif" align="left">网址名修改</p></td>
          </tr>
        </table></td>
    </tr>
    <tr> 
      <td width="25%" valign="top" class="td1"><a name="bottom"></a>
        <form name="frm" method="POST" action="../service/url.asp" onSubmit="return require(this)">
          <input type="hidden" name="mode" value="edit">
		  <input type="hidden" name="id" >
          <table border="0" width="100%" cellspacing="10" cellpadding="0">
            <tr> 
              <td width="100%" height="11">网址标题: 
                <input type="text" name="Title" size="30" maxlength="100" class="input"> 
                <font COLOR="RED">*</font> </td>
            </tr>
            <tr>
              <td height="12">网址:  
                <input name="url" type="text" class="input" id="url" size="30" maxlength="100"></td>
            </tr>
            <tr> 
              <td width="100%" height="21"> <div align="center"> 
                  <input type="submit" value="修改"  class="button0" onmouseout=className="button0" onmouseover=className="button1">
                  <input type="reset" value="重写"  class="button0" onmouseout=className="button0" onmouseover=className="button1">
                </div></td>
            </tr>
          </table>
        </form></td>
    </tr>
    <tr> 
      <td width="25%" class="tdBottom"> </td>
    </tr>
  </table>
</div>
</body>

</html>

<%'释放对象变量
oConn.close
%> 

⌨️ 快捷键说明

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