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

📄 gustbook_sub.asp

📁 以留言本为例
💻 ASP
字号:
<% 	
	Function RongCuo(RongCuoName,MaxValue,TrueValue)	'容错判断是否是数字且在范围(0到..)之内
		If Not Isnumeric(RongCuoName) then
			If RongCuoName="" then
				RongCuo=TrueValue
			Else
				RongCuo=RongCuoName
			End If
		ElseIf MaxValue=0 and RongCuoName<0 then	'如该数无最大要求,则,若为负即赋予默认值
			RongCuo=TrueValue
		ElseIf MaxValue<>0 and (RongCuoName<0 or RongCuoName>MaxValue) then
				''如该数有最大要求,则,若为负或超过最大值即赋予默认值
			RongCuo=TrueValue
		Else
			RongCuo=RongCuoName
		End If
	End Function

Sub DQE_gustbook(lanmu,bookNum,LeftNum,bookform,bookname)

	'Call DQE_gustbook(5,4,25,1,"留言区")
	'详细参数说明
	'lanmu ------- 调用评论的栏目:容错默认为0
	'bookNum ------- 评论条数:容错默认为5
	'LeftNum ------- 显示标题最左边的字符数,默认40,一个汉字算两个字符
	'bookform ------- 是否显示发言表单, 默认0为不显示,1为显示,并自定义,容错默认为0
	'bookname ------- 显示在评论页面的标题:必须加双引号,如:"留言区"
	lanmu=RongCuo(lanmu,0,0)
	bookNum=RongCuo(bookNum,0,5)
	LeftNum=RongCuo(LeftNum,50,40)
	bookform=RongCuo(bookform,1,0)
 %>
<style type="text/css">
<!--
.xianyan {
    font-family: "宋体";
	font-size: 9pt;
	color: #FF6600;
	font-weight: bold;
}
.wenzi {
	font-family: "宋体";
	font-size: 9pt;
	color: #333333;
}
.huisekuang {
	border: 1px solid #E7E7E7;
}
-->
</style>
 <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td colspan="3" class="huisekuang"><table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="20">
<% Set mRs= Server.CreateObject("adodb.recordSet")
	mRs.open "Select * from dqe_gustbook where lanmu="&lanmu, conn, 1, 1 
	dim plrenshu
	plrenshu=0
	do while not mRs.eof
	plrenshu=plrenshu+1
	mRs.movenext
	loop
	mRs.Close
	Set mRs = nothing
	%><div align="left"><span class="wenzi">现在有<span class="xianyan"><%= plrenshu %></span>人发表评论 <a href="<%= Url %>?lanmu=<%= lanmu %>&xsming=<%= bookname %>"><span class="xianyan">查看所有评论</span></a></span></div></td>
        </tr>
      <tr>
        <td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="huisekuang">
          <% Set mRs= Server.CreateObject("adodb.recordSet")
	mRs.open "Select * from dqe_gustbook where lanmu="&lanmu, conn, 1, 1 
	dim tiaoshu
	tiaoshu=0
	do while not mRs.eof and tiaoshu<bookNum+1
		%><% tiaoshu=tiaoshu+1 %><tr>
            <td height="18"><span class="wenzi">【<%= mRs("who") %>】说:<%= left(mRs("biaoti"),LeftNum) %> <% response.write "<font color=999999>["&month(mRs("shijian"))&"月"&day(mRs("shijian"))&"日]</font>" %></span> </td>
            </tr>
			<% mRs.movenext
	loop %><% mRs.Close
	Set mRs = nothing %>          
        </table></td>
        </tr><% If bookform=1 Then %>
      <tr>
        <td height="160" align="left" valign="bottom"><form name="form1" method="post" action="<%= Url %>?lanmu=<%= lanmu %>&xsming=<%= bookname %>">
          <table width="100%" height="140"  border="0" cellpadding="0" cellspacing="0" class="huisekuang">
            <tr>
              <td width="5%" height="30"><div align="center"><span class="wenzi">作者:</span> </div></td>
              <td width="10%" height="30"><input name="textfield2" type="text" class="huisekuang" size="10"></td>
              <td width="6%" height="30"><div align="center"><span class="wenzi">标题:</span></div></td>
              <td width="79%" height="30">                <input name="textfield" type="text" class="huisekuang" size="25"></td>
            </tr>
            <tr>
              <td height="80"><div align="center"><span class="wenzi">内容:</span> </div></td>
              <td height="80" colspan="3"><textarea name="textarea" cols="50" rows="5" class="huisekuang"></textarea></td>
            </tr>
            <tr>
              <td height="25"></td>
              <td height="25" colspan="3"><div align="left">
                <input type="Submit" name="Submit" value="提交评论" style="background-color: #FFFFFF; border-color: #E7E7E7; border-style: solid; border-width: 1px 1px 1px"
>
              </div></td>
              </tr>
          </table>
        </form></td>
        </tr><% End If %>
    </table></td>
   </tr>
</table> 
	<%  End Sub %>

⌨️ 快捷键说明

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