|          
上二篇里,我们已经把留言本的功能、数据库、文件、CSS等都设计好了,现在我们要来完成代码部份。
 一、包含函数库
 <!--#include file="operation$db.asp" -->
 
 在文件第一行加上包含语句
 二、根据action 参数来判断
 <%
 action=request("action")
 select case action
 case "logout"
 logout    '退出登录子程序
 case "login"
 login    '登录子程序
 case "replay"
 replay    '回贴子程序
 case "delete"  '表示删除贴子
 if session("lybmanage")="" then  '如果还没有登录,
 response.redirect "index.asp?action=manage"  '就显示登录界面
 else
 delete  '否则,去删除贴子
 end if
 case "addrec"    '增加新贴子
 addrec()    '加入新贴
 response.redirect "index.asp" '然后转到初始页
 case "modify"  '表示修改留言本信息
 if session("lybmanage")="" then  '如果还没有登录,
 response.redirect "index.asp?action=manage"    '就显示登录界面
 else
 modify  '否则,修改信息
 response.redirect "index.asp"  '然后,回初始页面
 end if
 end select
 %>
 
 
 三、根据上面的action,要有以下几个子程序
 <%
 '退出登录子程序
 sub logout()
 '删除session变量lybmanage
 session.contents.remove "lybmanage"
 '转到初始页面
 response.redirect "index.asp"
 end sub
 
 '登录子程序
 sub login()
 '取得登录参数
 user=request.form("user")
 pwd=request.form("pwd")
 if user<>"" and pwd<>"" then '参数都不为空时才检查
 opendb my '打开数据库连接
 '定义SQL查询,寻找用户名相等的记录
 sql="select * from admin where admin_user='"&user&"'"
 '查询表用于读
 searchtable my,sql,rs
 if not rs.eof then '如果有这样的用户
 if pwd=rs("admin_pass") then '判断密码是否相等
 session("lybmanage")=user '相等,就记录到session变量里
 end if
 end if
 end if
 response.redirect "index.asp"  '不管登录与否,都回到初始页面
 end sub
 
 '修改留言本信息子程序
 sub modify()
 '取得密码
 pwd=request.form("pwd")
 if pwd="" then exit sub '没有密码不修改
 newpwd=request.form("newpwd")'取得新密码
 opendb my '打开数据库连接
 '定义SQL查询语句
 sql="select * from admin where admin_user='"&session("lybmanage")&"'"
 '打开表用于读
 changetable my,sql,rs
 if not rs.eof then
 '下面修改信息
 if pwd=rs("admin_pass") then
 if newpwd<>"" then
 rs("admin_pass")=newpwd
 end if
 rs("admin_nick")=request.form("nick")
 rs("admin_name")=request.form("name")
 rs("admin_homepage")=request.form("homepage")
 rs("admin_perpage")=request.form("perpage")
 rs.update
 end if
 end if
 '关闭表和数据库连接
 closetable rs
 closedb my
 '完成后转到初始页面
 response.redirect "index.asp"
 end sub
 
 '回复子程序
 sub replay()
 '如果没有登录,直接退出
 if session("lybmanage")="" then exit sub
 '取得表单内容
 rep=pro(request.form("rep"))
 id=request.form("id")
 '打开数据库连接
 opendb my
 '定义SQL查询
 sql="select * from main where user_id =" & id
 '打开表用于写
 changetable my,sql,rs
 '写入
 rs("user_replay")=true
 rs("user_rep")=rep
 rs("user_reptime")=now()
 rs.update
 '关闭表和数据库连接
 closetable rs
 closedb my
 '转到初始页
 response.redirect "index.asp"
 end sub
 
 
 '删除贴子程序
 sub delete()
 '如果没登录,直接退出
 if session("lybmanage")="" then exit sub
 '取得删除的贴子的ID
 id=request("id")
 '打开数据库连接
 opendb my
 '定义SQL查询
 sql="select * from main where user_id =" & id
 '打开表用于写
 changetable my,sql,rs
 '删除贴
 rs.delete
 rs.update
 '关闭表和数据库连接
 closetable rs
 closedb my
 '转到初始页面
 response.redirect "index.asp"
 end sub
 
 '加新贴子程序
 sub addrec()
 '打开数据库连接
 opendb my
 '定义SQL查询
 sql="select * from main where user_id is null"
 '打开
 changetable my,sql,rs
 '加入新记录
 rs.addnew
 rs("user_ip")=request.servervariables("remote_addr")
 rs("user_name")=request.form("name")
 rs("user_email")=request.form("email")
 rs("user_oicq")=request.form("oicq")
 rs("user_from")=request.form("from")
 rs("user_http")=request.form("http")
 rs("user_face")=request.form("face")
 '留言的内容要处理一下再入库
 rs("user_ly")=pro(request.form("ly"))
 rs.update
 '关闭表和数据库连接
 closetable rs
 closedb my
 end sub
 %>
 
 
 四、在<html>标签之前,还要加入读取留言本信息的程序段,用来显示导航条
 <%
 opendb my
 opentable my,"main",rs
 homepage=rs("user_homepage")
 name=rs("user_nick")
 user=rs("user_name")
 perpage=rs("user_perpage")
 closetable rs
 closedb my
 %>
 
 
 五、现在来完成最重要的几个部份,也就是在<html></html>之间的部份。
 有这么几个:
 最开始是显示一个简单的导航条
 <A HREF="#top"></A>
 <TABLE cellSpacing=0 cellPadding=1 width=650 align=center bgColor=#000000
 border=0>
 <TBODY>
 <TR>
 <TD>
 <TABLE class=table002 cellSpacing=0 cellPadding=4 width=650 border=0>
 <TBODY>
 <TR>
 <TD class=jnfont5 vAlign=center align=left><B>>> </B><A
 href="<%=homepage%>" title=返回主页>主页</A> | <A
 href="index.asp?action=showmodify" title=编辑你的个人资料>修改资料</A> |
 <%if session("lybmanage")="" then%>
 <A href="index.asp?action=manage" title=回复或删除留言>留言管理</A>
 <%else%>
 <a href="index.asp?action=logout" title=退出管理模式>退出管理</a>
 <%end if%>
 </TD>
 <TD class=jnfont5 vAlign=center align=right>
 <%=name&"留言薄"%>
 </TD>
 </TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
 <br>
 
 然后根据参数选择后面要显示的部份
 <%action=request("action")
 select case action
 case ""
 showadd
 showrec
 case "showmodify"
 if session("lybmanage")="" then
 showlogin
 else
 showmodify
 end if
 case "manage"
 if session("lybmanage")="" then
 showlogin
 else
 showadd
 showrec
 end if
 end select%>
 
 下面是这几个子程序:
 showadd 显示加新贴表单子程序
 <%sub showadd()%>
 <DIV align=center>
 <FORM onsubmit="return Juge(this)" action="index.asp" method="post">
 <TABLE cellSpacing=1 cellPadding=3 width=650 bgColor=#000000 border=0>
 <TBODY>
 <TR>
 <TD class=table001 vAlign=top width=300 height=170>
 <TABLE cellSpacing=2 cellPadding=2 width="95%" border=0>
 <TBODY>
 <TR>
 <TD width="9%" align="center"><IMG height=24 src=http://cfan.net.cn/info/"images/nc.gif"
 width=24></TD>
 <TD class=jnfont3 width="14%">姓名</TD>
 <TD width="77%"><INPUT class=input1 maxLength=20 name=name>
 <INPUT
 type=hidden value=<%%> name=user>
 </TD></TR>
 <TR>
 <TD width="9%" align="center"><IMG height=16 src=http://cfan.net.cn/info/"images/email.gif" width=16
 border=0></TD>
 <TD class=jnfont3 width="14%">Email</TD>
 <TD width="77%"><INPUT class=input1 maxLength=100 name=email> </TD></TR>
 <TR>
 <TD width="9%" align="center"><IMG height=16 src=http://cfan.net.cn/info/"images/from.gif"
 width=16></TD>
 <TD class=jnfont3 width="14%">来自</TD>
 <TD width="77%">
 <select size=1 name=from>
 <option value=北京>北京
 <option value=广东>广东
 <option value=上海>上海
 <option value=新疆>新疆
 <option value=辽宁>辽宁
 <option value=广西>广西
 <option value=海南>海南
 <option value=湖南>湖南
 <option value=甘肃>甘肃
 <option value=河北>河北
 <option value=湖北>湖北
 <option value=江西>江西
 <option value=江苏>江苏
 <option value=西藏>西藏
 <option value=山东>山东
 <option value=浙江>浙江
 <option value=安徽>安徽
 <option value=福建 selected>福建
 <option value=吉林>吉林
 <option value=黑龙江>黑龙江
 <option value=山西>山西
 <option value=云南>云南
 <option value=贵州>贵州
 <option value=四川>四川
 <option value=陕西>陕西
 <option value=重庆>重庆
 <option value=天津>天津
 <option value=河南>河南
 <option value=青海>青海
 <option value=宁夏>宁夏
 <option value=台湾>台湾
 <option value=香港>香港
 <option value=澳门>澳门
 <option value=其它地区>其它地区</option>
 </select>
 </TD>
 </TR>
 <TR>
 <TD width="9%" align="center"><IMG height=16 src=http://cfan.net.cn/info/"images/homepage.gif"
 width=16 border=0></TD>
 <TD class=jnfont3 width="14%">主页</TD>
 <TD width="77%">
 <INPUT class=input1 maxLength=100 size=30 name=http>
 </TD></TR>
 <TR>
 <TD width="9%" align="center"><IMG height=16 src=http://cfan.net.cn/info/"images/oicq.gif" width=16
 border=0></TD>
 <TD class=jnfont3 width="14%">oicq</TD>
 <TD width="77%"><INPUT class=input1 maxLength=20 name=oicq> </TD></TR>
 <TR>
 <TD width="9%" align="center"><IMG height=18 src=http://cfan.net.cn/info/"images/icq.gif" width=18
 border=0></TD>
 <TD class=jnfont3 width="14%">icq</TD>
 <TD width="77%"><INPUT class=input1 maxLength=20 name=icq> </TD></TR>
 <TR>
 <TD class=jnfont3 colSpan=2 align="center">您的尊容:</TD>
 <TD class=jnfont5 width="77%"><SELECT size=1 name=face>
 <OPTION value=images/1.gif selected >头像1
 <OPTION value=images/2.gif>头像2
 <OPTION value=images/3.gif>头像3
 <OPTION value=images/4.gif>头像4
 <OPTION value=images/5.gif>头像5
 <OPTION value=images/6.gif>头像6
 <OPTION value=images/7.gif>头像7
 <OPTION value=images/8.gif>头像8
 <OPTION value=images/9.gif>头像9
 <OPTION value=images/10.gif>头像10
 <OPTION value=images/11.gif>头像11
 <OPTION value=images/12.gif>头像12
 <OPTION value=images/13.gif>头像13
 <OPTION value=images/14.gif>头像14
 <OPTION value=images/15.gif>头像15
 <OPTION value=images/16.gif>头像16
 <OPTION value=images/17.gif>头像17
 <OPTION value=images/18.gif>头像18
 <OPTION value=images/19.gif>头像19
 <OPTION value=images/20.gif >头像20
 <OPTION value=images/21.gif >头像21
 <OPTION value=images/22.gif>头像22
 </OPTION></SELECT>
 <A href="javascript:popwin3('tou.htm')">查看头像列表</A>
 </TD></TR></TBODY></TABLE></TD>
 <TD class=table001 vAlign=top width=300 height=170>
 <TABLE cellSpacing=2 cellPadding=2 width=292 align=center border=0>
 <TBODY>
 <TR>
 <TD width=10><IMG height=24 src=http://cfan.net.cn/info/"images/post.gif"
 width=24></TD>
 <TD class=jnfont3 width=119>内容</TD>
 <TD class=jnfont5 width=119>
 <DIV align=center><A
 href="javascript:popwin3('pubb.htm')">UBB代码用法</A></DIV></TD></TR>
 <TR>
 <TD colSpan=3><TEXTAREA class=testarea1 name=ly rows=5 cols=44 type="text"></TEXTAREA>
 </TD></TR>
 <TR>
 <TD class=jnfont3 colSpan=3>
 1)留言者不能发布任何不符合当地法规、国家法律和国际法律的资料; </TD></TR>
 <TR>
 <TD class=jnfont3 colSpan=3>
 2)留言者不得发布任何非法的、骚扰性的、中伤他人的、辱骂性的、恐吓性的、伤害性的、庸俗的,淫秽等信息资料;
 <input type="hidden" name="action" value="addrec">
 <script language=JavaScript>
 <!--
 
 function Juge(theForm)
 {
 if (theForm.name.value == "")
 {
 alert("请输入您的姓名!");
 theForm.name.focus();
 return (false);
 }
 if (checktext(theForm.name.value))
 {
 alert("请您输入有效姓名!");
 theForm.name.select();
 theForm.name.focus();
 return (false);
 }
 
 if (theForm.email.value == "")
 {
 alert("请您输入\"email\"!");
 theForm.email.focus();
 return (false);
 }
 if (theForm.ly.value == "")
 {
 alert("请您输入内容!");
 theForm.ly.focus();
 return (false);
 }
 
 var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_@.";
 var checkStr = theForm.email.value;
 var allValid = true;
 for (i = 0;  i < checkStr.length;  i++)
 {
 ch = checkStr.charAt(i);
 for (j = 0;  j < checkOK.length;  j++)
 if (ch == checkOK.charAt(j))
 break;
 if (j == checkOK.length)
 {
 allValid = false;
 break;
 }
 }
 
 if (theForm.email.value.length < 6)
 {
 allValid = false;
 }
 
 if (!allValid)
 {
 alert("您输入的 \"电子邮件地址\" 无效!");
 theForm.email.focus();
 return (false);
 }
 
 address=theForm.email.value;
 if(address.length>0)
 {
 i=address.indexOf("@");
 if(i==-1)
 {
 window.alert("对不起!您输入的电子邮件地址是错误的!")
 theForm.email.focus();
 return false
 }
 ii=address.indexOf(".")
 if(ii==-1)
 {
 window.alert("对不起!您输入的电子邮件地址是错误的!")
 theForm.email.focus();
 return false
 }
 
 }
 if (checktext(theForm.email.value))
 {
 alert("请您输入有效的\"email\"!");
 theForm.email.select();
 theForm.email.focus();
 return (false);
 }
 
 }
 
 
 function checktext(text)
 {
 allValid = true;
 
 for (i = 0;  i < text.length;  i++)
 {
 if (text.charAt(i) != " ")
 {
 allValid = false;
 break;
 }
 }
 
 return allValid;
 }
 
 //-->
 </script>
 </TD>
 </TR></TBODY></TABLE></TD></TR>
 <TR class=table003>
 <TD colSpan=2>
 <DIV align=center>
 <INPUT class=input2 type=submit value=提交>
    
 <INPUT class=input2 type=reset value=重填>
 </DIV></TD></TR></TBODY></TABLE>
 </FORM>
 <%end sub%>
 </DIV>
 
 showrec 显示记录子程序
 <%sub showrec()
 page=1
 if request("page")<>"" then
 page=cint(request("page"))
 end if
 
 opendb my
 sql="select * from main order by user_time desc"
 searchtable my,sql,rs
 if rs.eof then
 closetable rs
 closedb my
 response.write "<center>还没有人留言呢!</center>"
 exit sub
 end if
 rs.pagesize=perpage
 rs.absolutepage=page
 totalpage=rs.pagecount
 %>
 <DIV align=center>
 <table class=jnfont5 cellspacing=1 cellpadding=3 width=650 bgcolor=#000000>
 <tbody>
 <tr class=table003>
 <form action=index.asp method=get>
 <td align=middle width="40%">
 <div align=center>关键字:
 <input type=hidden value=search name=action22>
 <input class=input2 size=15 name=key2>
  
 <input class=input2 type=submit value="搜索" name="submit2">
 </div>
 </td>
 </form>
 <form name="change1" action=index.asp method=get>
 <td valign=center align="center">
 <%if page=1 then
 response.write ("【首页】【上页】 ")
 else
 response.write ("【<a href=index.asp?page=1"&str&">首页</a>】")
 response.write ("【<a href=index.asp?page="& page-1 & str & ">上页</a>】")
 end if%>
 转到第
 <select name="page" onChange="change1.submit()">
 <%for i=1 to totalpage
 if page=i then
 response.write "<option selected>"&i&"</option>"
 else
 response.write "<option >" &i&"</option>"
 end if
 next
 %>
 </select>
 页
 <%
 if page=totalpage then
 response.write ("【下页】【尾页】")
 else
 response.write ("【<a href=index.asp?page=" & page+1 & str & ">下页</a>】")
 response.write ("【<a href=index.asp?page=" & totalpage & str& ">尾页</a>】")
 end if%>
 </td>
 </form>
 </tr>
 </tbody>
 
 <br>
 <%
 for i=1 to perpage
 if not rs.eof then
 %>
 <TABLE cellSpacing=1 cellPadding=3 width=650 bgColor=#000000>
 <TBODY>
 <TR bgColor=#ffffff>
 <TD class=table001 vAlign=top width=120 rowSpan=2>
 <CENTER>
 <TABLE class=jnfont7>
 <FONT color=#ffffff><%=rs("user_name")%></FONT> <TBODY></TBODY>
 </TABLE>
 <IMG src="<%=rs("user_face")%>" border=0 width="82" height="90"> <BR>
 来自- <%=rs("user_from")%>
 </CENTER>
 </TD>
 <TD class=table002 style="WORD-BREAK: break-all" vAlign=top width=530
 height=105>
 <TABLE cellSpacing=0 cellPadding=0 width="100%" border="0">
 <TBODY>
 <TR>
 <TD width=26><IMG height=24 src=http://cfan.net.cn/info/"images/post.gif" width=24></TD>
 <TD>留言内容:
 <%if rs("user_email")<>"" then%>
 <A title="给<%=rs("user_name")%>发信" href="mailto:<%=rs("user_email")%>">
 <IMG height=16 src=http://cfan.net.cn/info/"images/email.gif" width=16 border=0>信箱</A>
 <%end if%>
 <%if rs("user_http")<>"" then%>
 <A title="访问<%=rs("user_name")%>的主页" href=<%=rs("user_http")%> target=_blank >
 <img height=16 src=http://cfan.net.cn/info/"images/homepage.gif"
 width=16 border=0>主页</a>
 <%end if%>
 <%if rs("user_oicq")<>"" then%>
 <A title="<%=rs("user_name")%>的QQ号码:
 <%=rs("user_oicq")%>"
 href="http://search.tencent.com/cgi-bin/friend/user_show_info?ln=<%=rs("user_oicq")%>"
 target=_blank>
 <IMG height=16 src=http://cfan.net.cn/info/"images/oicq.gif" width=16 border=0><%=rs("user_oicq")%></A>
 <%end if%>
 <IMG height=15 alt="<%=rs("user_ip")%>" src=http://cfan.net.cn/info/"images/ip.gif" width=16>
 <%=rs("user_ip")%> </TD>
 <TD width=80 align="center">第 <%=i+(page-1)*perpage%> 条 <a href="#top" title=回顶部>∧</a></TD>
 </TR>
 </TBODY>
 </TABLE>
 <HR SIZE=1>
 <%=rs("user_ly")%> </TD>
 </TR>
 <TR class=table001>
 <TD height=13 align="right">
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr>
 <td>
 <%if session("lybmanage")<>"" then
 response.write "<a href='index.asp?action=delete&id="&rs("user_id")&"'>删除</a>"
 end if%>
 </td>
 <td align="right">发表于: <%=rs("user_time")%>
 <%if rs("user_replay") then%>
 回复于:<%=rs("user_reptime")%>
 <%end if%>
 </td>
 </tr>
 
 
 </TD>
 </TR>
 </TBODY>
 <%if rs("user_replay") or session("lybmanage")<>"" then%>
 <tr class=table002>
 <td valign=top width=120>
 <div align=center>版主回复<br>
 <img src=http://cfan.net.cn/info/"images/repost.gif"
 border=0 width="24" height="24"><br>
 <table class=jnfont5>
 <%=user%>
 
 </div>
 </td>
 <td width=530>
 <table class=jnfont5>
 <%if rs("user_replay") and session("lybmanage")="" then%><%=rs("user_rep")%>
 <%else%>
 <tbody><tr><td><form onsubmit="return check(this)" action="index.asp" method="post">
 <textarea class=testarea1 name="rep" cols="44" rows="5">
 <%if rs("user_replay") then response.write unpro(rs("user_rep"))%></textarea>
 <input type="hidden" name="action" value="replay">
 <input type="hidden" name="id" value="<%=rs("user_id")%>">
 <script language="JavaScript">
 function check(theForm)
 {
 if (theForm.rep.value == "")
 {
 alert("请输入回复内容!");
 theForm.rep.focus();
 return (false);
 }
 }
 </script>
 <input class=input2 type="submit" value="回复">
 </form></td></tr></tbody>
 <%end if%>
 
 </td>
 </tr>
 <%end if%>
 </TABLE>
 <BR>
 <%rs.movenext
 end if
 next
 closetable rs
 closedb my
 end sub
 %>
 
 显示登录表单子程序
 <%sub showlogin()%>
 <br>
 <table cellspacing=1 cellpadding=0 width=200 align=center bgcolor=#000000
 border=0>
 <tbody>
 <tr class=table003>
 <td width="50%">
 <table class=jnfont7 align=center>
 <font color=#ffffff>管理员登录</font> <tbody></tbody>
 
 </td>
 </tr>
 <tr class=table001>
 <td valign=top width="50%">
 <table cellspacing=1 cellpadding=0 width="100%" border=0>
 <tbody>
 <form name="login" onsubmit="return check2(login)" action="index.asp" method="post">
 <tr>
 <td class=jnfont3 width="100%">
 <p align=center>用户名:
 <input class=input1 maxlength=20 size=13 name="user">
 <br>
 密  码:
 <input class=input1
 type=password maxlength=20 size=13 name="pwd">
 <br>
 <input type="hidden" name="action" value="login">
 <input class=input1 type=submit value=" 登 陆 ">
 </p>
 </td>
 </tr>
 <tr>
 <td class=jnfont3 width="100%">
 <p align=right>
 <script language="JavaScript">
 function check2(theForm)
 {
 if (theForm.user.value == "")
 {
 alert("请输入用户名!");
 theForm.user.focus();
 return (false);
 }
 if (theForm.pwd.value == "")
 {
 alert("请输入密码!");
 theForm.pwd.focus();
 return (false);
 }
 }
 </script>
 『<a
 href="index.asp">返回</a>』</p>
 </td>
 </tr>
 </form>
 </tbody>
 
 </tr>
 </tbody>
 
 <%end sub%>
 
 显示修改信息表单
 <%sub showmodify()
 opendb my
 opentable my,"admin",rs%>
 <table cellspacing=1 cellpadding=0 width=300 align=center bgcolor=#000000
 border=0>
 <tbody>
 <tr class=table003>
 <td width="50%">
 <table class=jnfont7 align=center>
 <font color=#ffffff>留言薄信息修改</font> <tbody></tbody>
 
 </td>
 </tr>
 <tr class=table001>
 <td valign=top width="50%">
 <table cellspacing=1 cellpadding=0 width="100%" border=0>
 <tbody>
 <form onsubmit="return check(this)" action="index.asp" method="post">
 <tr>
 <td class=jnfont3 width="30%" align="right" height="15">用户名: </td>
 <td class=jnfont3 width="70%" height="15"><%=rs("admin_user")%> </td>
 </tr>
 <tr>
 <td class=jnfont3 width="30%" align="right" height="15">密  码:
 </td>
 <td class=jnfont3 width="70%" height="15">
 <input class=input1
 type=password maxlength=20 size=13 name=pwd>
 输入密码才能修改</td>
 </tr>
 <tr>
 <td class=jnfont3 width="30%" align="right" height="15">新密码: </td>
 <td class=jnfont3 width="70%" height="15">
 <input class=input1
 type=password maxlength=20 size=13 name=newpwd>
 不改请留空</td>
 </tr>
 <tr>
 <td class=jnfont3 width="30%" align="right" height="15">确定新密码: </td>
 <td class=jnfont3 width="70%" height="15">
 <input class=input1
 type=password maxlength=20 size=13 name=newpwd2>
 重输新密码</td>
 </tr>
 <tr>
 <td class=jnfont3 width="30%" align="right" height="15">昵称: </td>
 <td class=jnfont3 width="70%" height="15">
 <input class=input1
 type=text maxlength=20 size=13 name=nick value="<%=rs("admin_nick")%>">
 留言薄名字</td>
 </tr>
 <tr>
 <td class=jnfont3 width="30%" align="right" height="15">姓名: </td>
 <td class=jnfont3 width="70%" height="15">
 <input class=input1
 type=text maxlength=20 size=13 name=name value="<%=rs("admin_name")%>">
 版主名字</td>
 </tr>
 <tr>
 <td class=jnfont3 width="30%" align="right" height="15">主页: </td>
 <td class=jnfont3 width="70%" height="15">
 <input class=input1
 type=text maxlength=100 size=30 name=homepage value="<%=rs("admin_homepage")%>">
 </td>
 </tr>
 <tr>
 <td class=jnfont3 width="30%" align="right" height="15">每页显示: </td>
 <td class=jnfont3 width="70%" height="15">
 <select name="perpage">
 <%for i=5 to 20 step 5
 if rs("admin_perpage")=i then
 response.write "<option selected>"&i&"</option>"
 else
 response.write "<option >" &i&"</option>"
 end if
 next
 %>
 </select>
 条留言 </td>
 </tr>
 <tr>
 <td class=jnfont3 width="100%" align="center" colspan="2" height="15">
 <input type="hidden" name="action" value="modify">
 <input class=input1 type=submit value=" 修 改 " name="submit">
 </td>
 </tr>
 <tr>
 <td class=jnfont3 width="100%" colspan="2">
 <p align=right>
 <script language="JavaScript">
 function check(theForm)
 {
 if (theForm.pwd.value == "")
 {
 alert("请输入密码!");
 theForm.pwd.focus();
 return (false);
 }
 if (theForm.newpwd.value != "")
 {
 if (theForm.newpwd.value != theForm.newpwd2.value)
 {
 alert("两次输入的密码不相同!");
 theForm.newpwd.focus();
 return (false);
 }
 }
 if (theForm.nick.value == "")
 {
 alert("请输入昵称!");
 theForm.nick.focus();
 return (false);
 }
 if (theForm.name.value == "")
 {
 alert("请输入姓名!");
 theForm.name.focus();
 return (false);
 }
 if (theForm.homepage.value == "")
 {
 alert("请输入您的主页!");
 theForm.homepage.focus();
 return (false);
 }
 }
 </script>
 『<a
 href="index.asp">返回</a>』</p>
 </td>
 </tr>
 </form>
 </tbody>
 
 </tr>
 </tbody>
 
 <%closetable rs
 closedb my
 end sub
 %>
 
 最后,加上文件尾部的版权引用:
 <!--#include file="bott.htm" -->
 
 为了弹出一个窗口来显示头像和UBB用法,在<head></head>之间加入一个JS脚本:
 <script language=JavaScript>
 function popwin3(path){
 window.open(path,"","height=450,width=600,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
 }
 </script>
 
 
 好了。所有的代码都写完了,最后就是测试了。
 因为是第一次写这么长的文章,不管是编排上还是内容上,总会有不足的地方,还请大家多多见谅
 有什么意见,可以提出来,争取以后写得更好。
 下载地址:http://www.he-xi.com/download/newlyb.zip
 说明:下载后解压到一个文件夹中,把这个文件传到站点根目录下,然后访问该目录下的index.asp
 演示地址:http://www.he-xi.com/newlyb/
 |