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

hostkey俄罗斯、荷兰GPU显卡服务器/免费Windows Server

Hostkey.com成立于2007年的荷兰公司,主要运营服务器出租与托管,其次是VPS、域名、域名证书,各种软件授权等。hostkey当前运作荷兰阿姆斯特丹、俄罗斯莫斯科、美国纽约等数据中心。支持Paypal,信用卡,Webmoney,以及支付宝等付款方式。禁止VPN,代理,Tor,网络诈骗,儿童色情,Spam,网络扫描,俄罗斯色情,俄罗斯电影,俄罗斯MP3,俄罗斯Trackers,以及俄罗斯法...

韩国服务器租用优惠点评大全

韩国服务器怎么样?韩国云服务器租用推荐?韩国服务器距离中国近,有天然的地域优势,韩国服务器速度快而且非常稳定!有不少有亚洲市场的外贸公司选择韩国服务器开拓业务,韩国服务器因自身的优势也受到不少用户的青睐。目前的IDC市场上,韩国、香港、美国三个地方的服务器几乎占据了海外服务器的百分之九十以上。韩国服务器相比美国服务器来说速度更快,而相比香港机房来说则带宽更充足,占用市场份额非常大。那么,韩国服务器...

CloudCone闪购优惠洛杉矶MC机房VPS月$1.99 便宜可随意删除重开

CloudCone商家我们很多喜欢低价便宜VPS主机的肯定是熟悉的,个人不是特别喜欢他。因为我之前测试过几次,开通的机器IP都是不通的,需要删除且开通好几次才能得到一个可用的IP地址。当然他们家的优势也是有的,就是价格确实便宜,而且还支持删除重新开通,而且机房只有一个洛杉矶MC。实话,如果他们家能多几个机房,保持现在的特点,还是有很多市场的。CloudCone是来自美国的主机销售商,成立于2017...

站内搜索代码为你推荐
租车平台哪个好手机租赁平台哪个好?聚酯纤维和棉哪个好聚酯纤维面料和纯棉面料哪个好机械表和石英表哪个好石英表和机械表哪个好音乐播放器哪个好哪个音乐播放器最好录音软件哪个好什么软件用来录音更好?宝来和朗逸哪个好朗逸和宝来买哪个好电陶炉和电磁炉哪个好电陶炉和电磁炉哪个好?主要是炒菜,爆炒。海克斯皮肤哪个好联盟海克斯科技和抽皮肤哪个合适红茶和绿茶哪个好红茶和绿茶 那个更好电动牙刷哪个好电动牙刷和普通牙刷哪个好,有何区别?
解析域名 域名出售 adman godaddy主机 gomezpeer 日志分析软件 iis安装教程 php免费空间 小米数据库 福建天翼加速 柚子舍官网 七夕快乐英文 赞助 网站卫士 绍兴电信 能外链的相册 贵阳电信测速 密钥索引 碳云 九零网络 更多