分页Asp美化代码 及Google和百度、雅虎的站内搜索代码

站内搜索代码  时间:2021-01-27  阅读:()

Asp美化代码及Google和百度、雅虎的站内搜索代码

<%

'#############类调用样例#################

'分页导航的样式

'<STYLE type=text/css>

' . tableBorder5 {'BORDER-RIGHT: #898e79 1px solid; BORDER-TOP: #898e791px solid; BORDER-LEFT: #898e79 1px solid; BORDER-BOTTOM: #898e79 1pxsol id; BACKGROUND-COLOR: #ffffff' }

'TD.TableTitle1 {'COLOR: #ffffff; BACKGROUND-COLOR: #ff6600' }'TD.TableTitle2 {'BACKGROUND-COLOR: #ffcc00' }

'TD.TableBody2 {'LINE-HEIGHT: 17px; BACKGROUND-COLOR: #efefef' }'</STYLE>

' sql语句

'新建类为biz

'Set biz=new ShowMorePage

'得到链接对象

'biz.getconn=conn

'得到sql语句

'biz.getsql=sql

'每页记录显示数量

'biz.pagesize=5

'创建记录集

' set rs=biz.getrs()

'显示分页导航可随处掉用并可调用多次

'biz. showpage()

'循环

'For i=1 to biz.GetCurPageNum

'显示内容

'rs.movenext

'Next

'释放所有对象

' set rs=nothing

' set biz=nothing

'########################################

===============类开始==============

Const Btn_First="首页" '定义第一页按钮显示样式

Const Btn_Prev="上一页" '定义前一页按钮显示样式

Const Btn_Next="下一页" '定义下一页按钮显示样式

Const Btn_Last="尾页" '定义最后一页按钮显示样式

Const XD_Align="Center" '定义分页信息对齐方式

Const XD_Width="200%" '定义分页信息框大小

Class ShowMorePage

Private

Obj_Conn,Obj_Rs,Str_Sql, int_PageSize,Str_Errors, Int_CurPage,Str_URL, Int_TotalPage, Int_TotalRecord

====================================

'PageSize属性

'设置每一页的分页大小

=========================================

Public Property Let PageSize(intvalue)

If IsNumeric(intvalue) Thenint_PageSize=CLng(intvalue)

Else

Str_Errors=Str_Errors & "PageSize的参数不正确"

ShowError()

End If

End Property

Public Property Get PageSize

If int_PageSize="" or (not(IsNumeric(int_PageSize) ) ) Then

PageSize=10

Else

PageSize=int_PageSize

End If

End Property

=======================================

'GetRS属性

'返回分页后的记录集

========================================

Public Property Get GetRs()if Int_TotalRecord= 0 then Call GetPage()

If not(Obj_Rs.eof and Obj_Rs.BOF) Thenif Int_CurPage<>1 thenif Int_CurPage-1<Int_TotalPage then

Obj_Rs.move (Int_CurPage-1)*PageSizedim bookmarkbookmark=Obj_Rs.bookmarkelse

Int_CurPage=1end ifend if

End If

Set GetRs=Obj_Rs

End Property

======================================

'GetCurPageNum属性

'返回当前页的记录集数目

========================================

Public Property Get GetCurPageNum()dim int_PageNumint_PageNum = int_PageSizeif Int_TotalRecord= 0 then Call GetPage()

If Int_CurPage>Int_TotalPage Then

Int_CurPage=Int_TotalPageint_PageNum = Int_TotalRecord-(Int_TotalPage-1)*int_PageSizeElseIf Int_CurPage=Int_TotalPage Thenint_PageNum = Int_TotalRecord-(Int_TotalPage-1)*int_PageSizeEnd If

GetCurPageNum = int_PageNum

End Property

==========================================

'GetConn得到数据库连接

'

===========================================

Public Property Let GetConn(sconn)

Set Obj_Conn=sconn

End Property

==========================================

'GetSQL得到查询语句

'

==========================================

Public Property Let GetSQL(svalue)

Str_Sql=svalue

End Property

=========================================

'Class_Initialize类的初始化

'初始化当前页的值

'

=========================================

Private Sub Class_Initialize

========================

'设定一些参数的黙认值

========================int_PageSize=10 '设定分页的默认值为10

Int_TotalRecord= 0

========================

'获取当前面的值

========================

If request("page")="" Then

Int_CurPage=1

ElseIf not(IsNumeric(request("page") ) ) ThenInt_CurPage=1

ElseIf CInt(Trim(request("page") ) )<1 Then

Int_CurPage=1

Else

Int_CurPage=CInt(Trim(request("page") ) )

End If

End Sub

======================================

'openRS打开数据集

'有首页、前一页、下一页、末页、还有数字导航'

======================================

Private Sub openRS()

Set Obj_Rs=Server.createobject("adodb.recordset")Obj_Rs.Open Str_Sql,Obj_Conn, 1, 1

End Sub

=========================================

'getPage创建分页导航条

'有首页、前一页、下一页、末页、还有数字导航'

=========================================

Private Sub GetPage()

If TypeName(Obj_Rs)<>"Object" Then Call openRS()Int_TotalRecord=Obj_Rs.RecordCount

If Int_TotalRecord<=0 Then

Str_Errors=Str_Errors & "暂无记录 "

Call ShowError()

End If

If Int_TotalRecord mod PageSize =0 Then

Int_TotalPage = Int_TotalRecord \ int_PageSizeElse

Int_TotalPage = Int_TotalRecord \ int_PageSize+1End If

If Int_CurPage>Int_TotalPage Then

Int_CurPage=Int_TotalPage

End If

End Sub

==========================================

'ShowPage创建分页导航条

'有首页、前一页、下一页、末页、还有数字导航

'

============================================

Public Sub ShowPage()

Dim str_tmp

Str_URL = GetUrl ()if Int_TotalRecord= 0 then Call GetPage()

============================================

'显示分页信息各个模块根据自己要求更改显求位置

============================================response.write "<table cellspacing=1 class=Tableborder5><tr>"str_tmp=ShowFirstPrvresponse.write str_tmps tr_tmp=showNumBtnresponse.write str_tmpstr_tmp=ShowNextLastresponse.write str_tmpstr_tmp=ShowPageInforesponse.write str_tmpresponse.write "</td></table>"

End Sub

==========================================

'ShowFirstPrv显示首页、前一页

'

'

==========================================

Private Function ShowFirstPrv()

Dim Str_tmp, int_prvpage

If Int_CurPage=1 Thenstr_tmp="<td width=60 align=center valign=middleclass=TableTitle1>"&Btn_First&"</td><td width=60 align=centervalign=middle class=TableTitle1>"&Btn_Prev&"</td>"

Elseint_prvpage=Int_CurPage-1str_tmp="<td width=60 align=center valign=middle class=TableTitle1><ahref="""&Str_URL & "1" & """>" & Btn_First&"</a></td><td width=60

align=center valign=middle class=TableTitle1><a href=""" & Str_URL &CStr(int_prvpage) & """>" & Btn_Prev&"</a></td>"

End If

ShowFirstPrv=str_tmp

End Function

=========================================

'ShowNextLast下一页、末页

'

'

=========================================

Private Function ShowNextLast()

Dim str_tmp, int_Nextpage

If Int_CurPage>=Int_TotalPage Thenstr_tmp="<td width=60 align=center valign=middleclass=TableTitle1>"&Btn_Next & "</td><td width=60 align=centervalign=middle class=TableTitle1>" & Btn_Last&"</td>"

Else

Int_NextPage=Int_CurPage+1

' str_tmp="<a href=""" & Str_URL & CStr(int_nextpage) & """>" &Btn_Next&"</a> <a href="""& Str_URL & CStr(Int_TotalPage) & """>" &Btn_Last&"</a>"str_tmp="<td width=60 align=center valign=middle class=TableTitle1><ahref="""&Str_URL&CStr(int_nextpage) &""">"&Btn_Next&"</a></td><tdwidth=60 align=center valign=middle class=TableTitle1><a href="""&Str_URL & CStr(Int_TotalPage) & """>" & Btn_Last&"</a></td>"

End If

ShowNextLast=str_tmp

End Function

===========================================

'ShowNumBtn数字导航

'每次显示10页

'

============================================

Private Function showNumBtn()

Dim i, str_tmp,m,n,mystrm = Int_CurPage - 4n = Int_TotalPageif n>1 thenfor i=Int_CurPage-5 to Int_CurPage+5'for i = 1 to 10if i<1 then i=1if m < 1 then m = 1

if m > n thenexit forend ifif i=Int_CurPage thenmystr=" class=tabletitle2"elsemystr=" class=TableBody2"end if

' str_tmp=str_tmp & "[<a href=""" & Str_URL& CStr(i) & """>"&i&"</a>] "str_tmp=str_tmp&"<td width=20 height=18 align=center valign=middle"&mystr &"><a href=""" & Str_URL & CStr(i) & """><b>"&i&"</b></a></td>"m = m + 1nextend ifshowNumBtn=s tr_tmp

End Function

===========================================

'ShowPageInfo分页信息

'更据要求自行修改

'

============================================

Private Function ShowPageInfo()

Dim str_tmp

' str_tmp="&nbsp;&nbsp;第<fontcolor=red>"&Int_CurPage&"</font>/"&Int_TotalPage&"页&nbsp;&nbsp;共<font color=red>"&Int_TotalRecord&"</font>条信息&nbsp;&nbsp;每页"&int_PageSize&"条"str_tmp="<td width=60 align=center valign=middleclass=TableTitle1>"&Int_CurPage&"/"&Int_TotalPage&"页</td>"

ShowPageInfo=str_tmp

End Function

=============================================

'GetURL得到当前的URL

'更据URL参数不同获取不同的结果

'

==========================================

Private Function GetURL()

Dim strUrl, tmp_URL, i, j, search_str,result_urlsearcstrUrl=Request.ServerVariables("URL")strUrl=split(strUrl, "/")

i=UBound(strUrl, 1)tmp_URL=strUrl (i) '得到当前页文件名str_params=Trim(Request.ServerVariables("QUERY_STRING") )

If str_params="" Thenresult_url=tmp_URL & "?page="

Else

If InstrRev(str_params, search_str)=0 Thenresult_url=tmp_URL & "?" & str_params &"&page="

Elsej=InstrRev(str_params, search_str)-2

If j=-1 Thenresult_url=tmp_URL & "?page="

Elsestr_lparams=Left(str_params, j)str_rparams=right(str_params, len(str_params)-j-1)if InStr(str_rparams, "&")<>0 thenstr_rparams=right(str_rparams, len(str_rparams)-InStr(str_rparams, "&")+1)elsestrend ifresult_url=tmp_URL & "?" & str_lparams&str_rparams&"&page="

End If

End If

End If

GetURL=result_url

End Function

===========================================

'设置Terminate事件。

'

===========================================

Private Sub Class_Terminate

Obj_Rs.close

Set Obj_Rs=nothing

Obj_Conn.closeset Obj_Conn = nothing

End Sub

=============================================

'ShowError错误提示

'

'

============================================

Private Sub ShowError()

If Str_Errors <> "" Then

Response.Write("" & Str_Errors & "")

Response.End

End If

End Sub

End class

%>google搜索代码

<form method="get" action="http://www.google.com/custom"target="google_window">

<table border="0" bgcolor="#ffffff">

<tr><td nowrap="nowrap" valign="middle" align="left" height="75"style="padding-top: 10px">

<a href="http://www.google.com/">

<img src="http://www.google.com/logos/Logo_25wht.gif" border="0"alt="Google" align="middle"></img></a>

<input type="text"name="q" size="32"maxlength="255" value=""></input><input type="submit" name="sa" value="搜索"></input>

<input type="hidden" name="client"value="pub-6854204841389277"></input>

<input type="hidden" name="forid" value="1"></input>

<input type="hidden" name="ie" value="GB2312"></input>

<input type="hidden" name="oe" value="GB2312"></input>

<input type="hidden" name="cof" value="

GALT:#008000;GL: 1 ;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;

GFNT:0000FF;GIMP:0000FF;LH:32;LW:75;

L:http://www.google.com/logos/Logo_25wht.gif;S:http://;LP: 1 ;FORID: 1"></input>

<input type="hidden" name="hl" value="zh-CN"></input>

</td></tr></table>

</form>

选择Vultr VPS主机不支持支付宝付款的解决方案

在刚才更新Vultr 新年福利文章的时候突然想到前几天有网友问到自己有在Vultr 注册账户的时候无法用支付宝付款的问题,当时有帮助他给予解决,这里正好顺带一并介绍整理出来。毕竟对于来说,虽然使用的服务器不多,但是至少是见过世面的,大大小小商家的一些特性特征还是比较清楚的。在这篇文章中,和大家分享如果我们有在Vultr新注册账户或者充值购买云服务器的时候,不支持支付宝付款的原因。毕竟我们是知道的,...

提速啦母鸡 E5 128G 61IP 1200元

提速啦(www.tisula.com)是赣州王成璟网络科技有限公司旗下云服务器品牌,目前拥有在籍员工40人左右,社保在籍员工30人+,是正规的国内拥有IDC ICP ISP CDN 云牌照资质商家,2018-2021年连续4年获得CTG机房顶级金牌代理商荣誉 2021年赣州市于都县创业大赛三等奖,2020年于都电子商务示范企业,2021年于都县电子商务融合推广大使。资源优势介绍:Ceranetwo...

数脉科技香港物理机 E3 16G 10M 华为线路165元 阿里云线路 188元 Cera线路 157元

2021年9月中秋特惠优惠促销来源:数脉科技 编辑:数脉科技编辑部 发布时间:2021-09-11 03:31尊敬的新老客户:9月优惠促销信息如下,10Mbps、 30Mbps、 50Mbps、100Mbps香港优质或BGPN2、阿里云线路、华为云线路,满足多种项目需求!支持测试。全部线路首月五折起。数脉官网 https://my.shuhost.com/香港特价数脉阿里云华为云 10MbpsCN...

站内搜索代码为你推荐
登陆qq空间首页QQ空间打开就显示主页华为p40和mate30哪个好华为mate30和荣耀3O那个好?核芯显卡与独立显卡哪个好独立显卡和核心显卡哪个好雅思和托福哪个好考现在考雅思还是托福好看书软件哪个好手机阅读软件哪个好用?云盘哪个好免费的网盘哪个好?更大、更安全、更实用?群空间登录怎样进入群空间dns服务器设置DNS服务器怎么设置??360云盘共享群360网盘共享群怎样利用最有价值?360云盘36t请问360云盘容量为什么最低有36T,其他IT行业的云盘都最多就2T?
虚拟主机管理软件 北京服务器租用 北京域名空间 樊云 asp.net主机 oneasiahost diahosting 外国服务器 wordpress技巧 ixwebhosting 京东云擎 512m内存 web服务器架设 微信收钱 vip域名 台湾谷歌 美国独立日 中国域名 申请免费空间 工信部icp备案查询 更多