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

六一云互联(41元)美国(24元)/香港/湖北/免费CDN/免费VPS

六一云互联六一云互联为西安六一网络科技有限公司的旗下产品。是一个正规持有IDC/ISP/CDN的国内公司,成立于2018年,主要销售海外高防高速大带宽云服务器/CDN,并以高质量.稳定性.售后相应快.支持退款等特点受很多用户的支持!近期公司也推出了很多给力的抽奖和折扣活动如:新用户免费抽奖,最大可获得500元,湖北新购六折续费八折折上折,全场八折等等最新活动:1.湖北100G高防:新购六折续费八折...

DediPath($1.40),OpenVZ架构 1GB内存

DediPath 商家成立时间也不过三五年,商家提供的云服务器产品有包括KVM和OPENVZ架构的VPS主机。翻看前面的文章有几次提到这个商家其中机房还是比较多的。其实对于OPENVZ架构的VPS主机以前我们是遇到比较多,只不过这几年很多商家都陆续的全部用KVM和XEN架构替代。这次DediPath商家有基于OPENVZ架构提供低价的VPS主机。这次四折的促销活动不包括512MB内存方案。第一、D...

特网云,美国独立物理服务器 Atom d525 4G 100M 40G防御 280元/月 香港站群 E3-1200V2 8G 10M 1500元/月

特网云为您提供高速、稳定、安全、弹性的云计算服务计算、存储、监控、安全,完善的云产品满足您的一切所需,深耕云计算领域10余年;我们拥有前沿的核心技术,始终致力于为政府机构、企业组织和个人开发者提供稳定、安全、可靠、高性价比的云计算产品与服务。公司名:珠海市特网科技有限公司官方网站:https://www.56dr.com特网云为您提供高速、稳定、安全、弹性的云计算服务 计算、存储、监控、安全,完善...

站内搜索代码为你推荐
美国10次啦导航美国GPS导航卫星手动挡和自动挡哪个好自动挡和手动挡哪个更好一点手机管家哪个好最好的手机管家行车记录仪哪个好请问行车记录仪那个牌子好?q空间登录腾讯qq空间登陆qq网盘在哪里QQ网盘在哪??????东莞电信网上营业厅怎样联系申请东莞中国电信固话360云网盘下载360云盘与百度云盘的对比广东联通网上营业厅广东联通网上营业厅如何办理一机双号?广东联通官方旗舰店联通营业厅买的号码需要多久才发货?
未注册域名查询 中文域名查询 申请免费域名 服务器配置技术网 enzu sugarsync rak机房 iisphpmysql 香港新世界电讯 52测评网 国外免费全能空间 135邮箱 云营销系统 免费asp空间申请 wordpress中文主题 如何登陆阿里云邮箱 大化网 香港ip 最新优惠 web服务器有哪些 更多