分页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>

注册做什么96%可以干啥,常用的7个常用的国内国外域名注册服务商_云服务器可以干什么

日前,国内知名主机服务商阿里云与国外资深服务器面板Plesk强强联合,推出 阿里云域名注册与备案、服务器ECS购买与登录使用 前言云服务器(Elastic  只需要确定cpu内存与带宽基本上就可以了,对于新手用户来说,我们在购买阿里云服务申请服务器与域名许多云服务商的云服务器配置是弹性的 三周学会小程序第三讲:服务 不过这个国外服务器有点慢,可以考虑国内的ngrokcc。 ngrokcc...

HostKvm香港VPS七折:$5.95/月KVM-2GB内存/40GB硬盘/500GB月流量

HostKvm是一家成立于2013年的国外主机服务商,主要提供VPS主机,基于KVM架构,可选数据中心包括日本、新加坡、韩国、美国、俄罗斯、中国香港等多个地区机房,均为国内直连或优化线路,延迟较低,适合建站或者远程办公等。商家本月针对香港国际机房提供特别7折优惠码,其他机房全场8折,优惠后2G内存香港VPS每月5.95美元起,支持使用PayPal或者支付宝付款。下面以香港国际(HKGlobal)为...

A400互联37.8元/季,香港节点cn2,cmi线路云服务器,1核/1G/10M/300G

A400互联怎么样?A400互联是一家成立于2020年的商家,A400互联是云服务器网(yuntue.com)首次发布的云主机商家。本次A400互联给大家带来的是,全新上线的香港节点,cmi+cn2线路,全场香港产品7折优惠,优惠码0711,A400互联,只为给你提供更快,更稳,更实惠的套餐,香港节点上线cn2+cmi线路云服务器,37.8元/季/1H/1G/10M/300G,云上日子,你我共享。...

站内搜索代码为你推荐
电脑杀毒软件哪个好电脑杀毒软件哪个好用手机杀毒软件哪个好手机杀毒清理软件哪个好啊炒股软件哪个好什么炒股软件比较好用?无纺布和熔喷布口罩哪个好大雾天气带什么样的口罩最好海克斯皮肤哪个好摄魂使者薇恩和海克斯安妮皮肤哪个好 怎么合成车险哪个好买汽车保险,买哪几种比较好电动牙刷哪个好电动牙刷和普通牙刷哪个好,有何区别?上海dns服务器地址上海市青浦区的电信DNS地址是多少360云盘关闭360云盘关闭个人云盘是吗?360云盘共享群360网盘怎样进共享群?
fc2新域名 云网数据 securitycenter 全球付 域名优惠码 空间打开慢 韩国名字大全 免费防火墙 中国网通测速 上海联通宽带测速 starry smtp服务器地址 免费asp空间申请 lamp架构 阿里云邮箱登陆地址 杭州电信宽带优惠 xuni 阿里dns 广州主机托管 mteam 更多