?? syscode.asp
字號:
'=================================================
'過程名:ShowSearchResult
'作 用:分頁顯示搜索結(jié)果
'參 數(shù):無
'=================================================
sub ShowSearchResult()
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
sqlSearch="select top " & MaxPerPage
else
sqlSearch="select "
end if
sqlSearch=sqlSearch & " * from Product where Passed=True "
if BigClassName<>"" then
sqlSearch=sqlSearch & " and BigClassName='" & BigClassName & "' "
if SmallClassName<>"" then
sqlSearch=sqlSearch & " and SmallClassName='" & SmallClassName & "' "
end if
else
if SpecialName<>"" then
sqlSearch=sqlSearch & " and SpecialName='" & SpecialName & "' "
end if
end if
if keyword<>"" then
select case strField
case "Title"
sqlSearch=sqlSearch & " and Title like '%" & keyword & "%' "
case "Content"
sqlSearch=sqlSearch & " and Content like '%" & keyword & "%' "
case else
sqlSearch=sqlSearch & " and Title like '%" & keyword & "%' "
end select
end if
sqlSearch=sqlSearch & " order by articleid desc"
Set rsSearch= Server.CreateObject("ADODB.Recordset")
rsSearch.open sqlSearch,conn,1,1
if rsSearch.eof and rsSearch.bof then
response.write "<p align='center'><br><br>沒有或沒有找到任何產(chǎn)品</p>"
else
if currentPage=1 then
call SearchResultContent()
else
if (currentPage-1)*MaxPerPage<totalPut then
rsSearch.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rsSearch.bookmark
call SearchResultContent()
else
currentPage=1
call SearchResultContent()
end if
end if
end if
rsSearch.close
set rsSearch=nothing
end sub
sub SearchResultContent()
dim i,strTemp,content
i=1
do while not rsSearch.eof
strTemp=""
strTemp=strTemp & cstr(i) & ".<a href='ArticleShow.asp?ArticleID=" & rsSearch("articleid") & "'>"
if strField="Title" then
strTemp=strTemp & "<b>" & replace(rsSearch("title"),""&keyword&"","<font color=red>"&keyword&"</font>") & "</b></font></a>"
else
strTemp=strTemp & "<b>" & rsSearch("title") & "</b></a>"
end if
strTemp=strTemp & " [" & FormatDateTime(rsSearch("UpdateTime"),1) & "]"
content=left(nohtml(rsSearch("content")),200)
if strField="Content" then
strTemp=strTemp & "<div style='padding:10px 20px'>" & replace(content,""&keyword&"","<font color=red>"&keyword&"</font>") & "……</div>"
else
strTemp=strTemp & "<div style='padding:10px 20px'>" & content & "……</div>"
end if
'strTemp=strTemp & "</a>"
response.write strTemp
i=i+1
if i>MaxPerPage then exit do
rsSearch.movenext
loop
end sub
'=================================================
'過程名:ShowSearch
'作 用:顯示文章搜索表單
'參 數(shù):ShowType ----顯示方式。1為縱向,2為橫向
'=================================================
sub ShowSearch(ShowType)
dim count
if ShowType<>1 and ShowType<>2 then
ShowType=1
end if
set rs=server.createobject("adodb.recordset")
sql = "select * from SmallClass order by SmallClassID asc"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("SmallClassName"))%>","<%= trim(rs("BigClassName"))%>","<%= trim(rs("SmallClassName"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.myform.SmallClassName.length = 1;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.SmallClassName.options[document.myform.SmallClassName.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<table border="0" cellpadding="2" cellspacing="0" align="center">
<form method="Get" name="myform" action="search.asp">
<tr><td height="28">
<select name="Field" size="1">
<option value="Title" selected>產(chǎn)品名稱</option>
<option value="Content">產(chǎn)品說明</option>
</select>
<%if ShowType=1 then%>
</td></tr>
<tr><td height="28">
<%end if%>
<select name="BigClassName" onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1">
<option selected value="">所有大類</option>
<%
if not (rsBigClass.bof and rsBigClass.eof) then
rsBigClass.movefirst
do while not rsBigClass.eof
response.Write "<option value='" & trim(rsBigClass("BigClassName")) & "'>" & trim(rsBigClass("BigClassName")) & "</option>"
rsBigClass.movenext
loop
end if
%>
</select>
<%if ShowType=1 then%>
</td></tr>
<tr><td height="28">
<%end if%>
<select name="SmallClassName">
<option selected value="">所有小類</option>
</select>
<%if ShowType=1 then%>
</td></tr>
<tr><td height="28">
<%end if%>
<input type="text" name="keyword" size=15 value="關(guān)鍵字" maxlength="50" onFocus="this.select();">
<input type="submit" name="Submit" value="搜索">
</td></tr>
</form>
</table>
<%
end sub
'=================================================
'過程名:ShowAllClass
'作 用:顯示所有欄目(欄目導(dǎo)航)
'參 數(shù):無
'=================================================
sub ShowAllClass()
if rsBigClass.bof and rsBigClass.eof then
response.Write " 沒有任何欄目"
else
dim sqlClass,rsClass,strClassName
rsBigClass.movefirst
do while not rsBigClass.eof
strClassName= "【<a href='Product.asp?BigClassName=" & rsBigClass("BigClassName") & "'><b>" & rsBigClass("BigClassName") & "</b></a>】<br><br>"
sqlClass="select * from SmallClass where BigClassName='" & rsBigClass("BigClassName") & "' Order by SmallClassID"
Set rsClass= Server.CreateObject("ADODB.Recordset")
rsClass.open sqlClass,conn,1,1
do while not rsClass.eof
strClassName=strClassName & " <a href='Product.asp?BigClassName=" & rsClass("BigClassName") & "&SmallClassName=" & rsClass("SmallClassName") & "'>" & rsClass("SmallClassName") & "</a> "
rsClass.movenext
loop
response.write strClassName & "<br><br>"
rsBigClass.movenext
loop
rsClass.close
set rsClass=nothing
end if
end sub
'=================================================
'過程名:ShowArticleContent
'作 用:顯示文章具體的內(nèi)容,可以分頁顯示
'參 數(shù):無
'=================================================
sub ShowArticleContent()
dim ArticleID,strContent,CurrentPage
dim ContentLen,MaxPerPage,pages,i,lngBound
dim BeginPoint,EndPoint
ArticleID=rs("ArticleID")
strContent=rs("Content")
ContentLen=len(strContent)
CurrentPage=trim(request("ArticlePage"))
if ShowContentByPage="No" or ContentLen<=200000 then
response.write strContent
if ShowContentByPage="Yes" then
response.write "</p><p align='center'></p>"
end if
else
if CurrentPage="" then
CurrentPage=1
else
CurrentPage=Cint(CurrentPage)
end if
pages=ContentLen\MaxPerPage_Content
if MaxPerPage_Content*pages<ContentLen then
pages=pages+1
end if
lngBound=MaxPerPage_Content '最大誤差范圍
if CurrentPage<1 then CurrentPage=1
if CurrentPage>pages then CurrentPage=pages
dim lngTemp
dim lngTemp1,lngTemp1_1,lngTemp1_2,lngTemp1_1_1,lngTemp1_1_2,lngTemp1_1_3,lngTemp1_2_1,lngTemp1_2_2,lngTemp1_2_3
dim lngTemp2,lngTemp2_1,lngTemp2_2,lngTemp2_1_1,lngTemp2_1_2,lngTemp2_2_1,lngTemp2_2_2
dim lngTemp3,lngTemp3_1,lngTemp3_2,lngTemp3_1_1,lngTemp3_1_2,lngTemp3_2_1,lngTemp3_2_2
dim lngTemp4,lngTemp4_1,lngTemp4_2,lngTemp4_1_1,lngTemp4_1_2,lngTemp4_2_1,lngTemp4_2_2
dim lngTemp5,lngTemp5_1,lngTemp5_2
dim lngTemp6,lngTemp6_1,lngTemp6_2
if CurrentPage=1 then
BeginPoint=1
else
BeginPoint=MaxPerPage_Content*(CurrentPage-1)+1
lngTemp1_1_1=instr(BeginPoint,strContent,"</table>",1)
lngTemp1_1_2=instr(BeginPoint,strContent,"</TABLE>",1)
lngTemp1_1_3=instr(BeginPoint,strContent,"</Table>",1)
if lngTemp1_1_1>0 then
lngTemp1_1=lngTemp1_1_1
elseif lngTemp1_1_2>0 then
lngTemp1_1=lngTemp1_1_2
elseif lngTemp1_1_3>0 then
lngTemp1_1=lngTemp1_1_3
else
lngTemp1_1=0
end if
lngTemp1_2_1=instr(BeginPoint,strContent,"<table",1)
lngTemp1_2_2=instr(BeginPoint,strContent,"<TABLE",1)
lngTemp1_2_3=instr(BeginPoint,strContent,"<Table",1)
if lngTemp1_2_1>0 then
lngTemp1_2=lngTemp1_2_1
elseif lngTemp1_2_2>0 then
lngTemp1_2=lngTemp1_2_2
elseif lngTemp1_2_3>0 then
lngTemp1_2=lngTemp1_2_3
else
lngTemp1_2=0
end if
if lngTemp1_1=0 and lngTemp1_2=0 then
lngTemp1=BeginPoint
else
if lngTemp1_1>lngTemp1_2 then
lngtemp1=lngTemp1_2
else
lngTemp1=lngTemp1_1+8
end if
end if
lngTemp2_1_1=instr(BeginPoint,strContent,"</p>",1)
lngTemp2_1_2=instr(BeginPoint,strContent,"</P>",1)
if lngTemp2_1_1>0 then
lngTemp2_1=lngTemp2_1_1
elseif lngTemp2_1_2>0 then
lngTemp2_1=lngTemp2_1_2
else
lngTemp2_1=0
end if
lngTemp2_2_1=instr(BeginPoint,strContent,"<p",1)
lngTemp2_2_2=instr(BeginPoint,strContent,"<P",1)
if lngTemp2_2_1>0 then
lngTemp2_2=lngTemp2_2_1
elseif lngTemp2_2_2>0 then
lngTemp2_2=lngTemp2_2_2
else
lngTemp2_2=0
end if
if lngTemp2_1=0 and lngTemp2_2=0 then
lntTemp2=BeginPoint
else
if lngTemp2_1>lngTemp2_2 then
lngtemp2=lngTemp2_2
else
lngTemp2=lngTemp2_1+4
end if
end if
lngTemp3_1_1=instr(BeginPoint,strContent,"</ur>",1)
lngTemp3_1_2=instr(BeginPoint,strContent,"</UR>",1)
if lngTemp3_1_1>0 then
lngTemp3_1=lngTemp3_1_1
elseif lngTemp3_1_2>0 then
lngTemp3_1=lngTemp3_1_2
else
lngTemp3_1=0
end if
lngTemp3_2_1=instr(BeginPoint,strContent,"<ur",1)
lngTemp3_2_2=instr(BeginPoint,strContent,"<UR",1)
if lngTemp3_2_1>0 then
lngTemp3_2=lngTemp3_2_1
elseif lngTemp3_2_2>0 then
lngTemp3_2=lngTemp3_2_2
else
lngTemp3_2=0
end if
if lngTemp3_1=0 and lngTemp3_2=0 then
lngTemp3=BeginPoint
else
if lngTemp3_1>lngTemp3_2 then
lngtemp3=lngTemp3_2
else
lngTemp3=lngTemp3_1+5
end if
end if
if lngTemp1<lngTemp2 then
lngTemp=lngTemp2
else
lngTemp=lngTemp1
end if
if lngTemp<lngTemp3 then
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -