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

gcorelabs远东khabarovsk伯力Cloud云服务器测评,告诉你gcorelabs云服务器怎么样

说明一下:gcorelabs的俄罗斯远东机房“伯力”既有“Virtual servers”也有“CLOUD SERVICES”,前者是VPS,后者是云服务器,不是一回事;由于平日大家习惯把VPS和云服务器当做一回事儿,所以这里要特别说明一下。本次测评的是gcorelabs的cloud,也就是云服务器。 官方网站:https://gcorelabs.com 支持:数字加密货币、信用卡、PayPal...

IntoVPS:按小时计费KVM月费5美元起($0.0075/小时),6个机房可选

IntoVPS是成立于2004年的Hosterion SRL旗下于2009年推出的无管理型VPS主机品牌,商家提供基于OpenStack构建的VPS产品,支持小时计费是他的一大特色,VPS可选数据中心包括美国弗里蒙特、达拉斯、英国伦敦、荷兰和罗马尼亚等6个地区机房。商家VPS主机基于KVM架构,最低每小时0.0075美元起($5/月)。下面列出几款VPS主机配置信息。CPU:1core内存:2GB...

HostYun(月18元),CN2直连香港大带宽VPS 50M带宽起

对于如今的云服务商的竞争着实很激烈,我们可以看到国内国外服务商的各种内卷,使得我们很多个人服务商压力还是比较大的。我们看到这几年的服务商变动还是比较大的,很多新服务商坚持不超过三个月,有的是多个品牌同步进行然后分别的跑路赚一波走人。对于我们用户来说,便宜的服务商固然可以试试,但是如果是不确定的,建议月付或者主力业务尽量的还是注意备份。HostYun 最近几个月还是比较活跃的,在前面也有多次介绍到商...

站内搜索代码为你推荐
鬼武者3内存修改器谁有鬼武者3的修改器,要没毒的,简单好用的美国10次啦导航与美国GPS可以抗衡的国产导航有哪些?手机杀毒软件哪个好手机用什么杀毒软件好尼康和佳能单反哪个好佳能和尼康哪个好雅思和托福哪个好考雅思和托福哪个好考一点美国国际东西方大学出国留学,美国“野鸡大学”有哪些?牡丹江教育云空间登录云空间怎么登入51个人空间登录51个人空间怎么申请???qq空间登录不上为什么我的QQ空间登陆不上?willyunlee最近开了007系列的第20部电影《择日再死》,看不懂剧情,不知说什么。谁能说给我听,谢谢。
天津虚拟主机 虚拟主机提供商 域名投资 动态域名解析软件 荣耀欧洲 fastdomain 免费主机 512m godaddy域名优惠码 搜狗抢票助手 华为网络硬盘 北京双线机房 免费吧 万网空间购买 网购分享 免费的asp空间 网页加速 阿里云个人邮箱 服务器托管价格 国外免费网盘 更多