?? syscode.asp
字號:
end sub
'=================================================
'過程名:ShowSearchResult
'作 用:分頁顯示搜索結果
'參 數:無
'=================================================
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 Productwygk 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 ID 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>null or haven't find any product </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='ProductShow.asp?ID=" & rsSearch("ID") & "'>"
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
'作 用:顯示文章搜索表單
'參 數: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>Product name</option>
<option value="Content">Product explains</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="">All bigclass</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="">All small class</option>
</select>
<%if ShowType=1 then%>
</td>
</tr>
<tr>
<td height="28">
<%end if%>
<input type="text" name="keyword" size=12 value="Keyword" maxlength="50" onFocus="this.select();">
<input type="submit" name="Submit" value="Search"> </td>
</tr>
</form>
</table>
<%
end sub
'=================================================
'過程名:ShowAllClass
'作 用:顯示所有欄目(欄目導航)
'參 數:無
'=================================================
sub ShowAllClass()
if rsBigClass.bof and rsBigClass.eof then
response.Write " nothing column"
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
'=================================================
'過程名:ShowProductContent
'作 用:顯示文章具體的內容,可以分頁顯示
'參 數:無
'=================================================
sub ShowProductContent()
dim ID,strContent,CurrentPage
dim ContentLen,MaxPerPage,pages,i,lngBound
dim BeginPoint,EndPoint
ID=rs("ID")
strContent=rs("Content")
response.write strContent
end sub
'=================================================
'過程名:ShowUserLogin
'作 用:顯示用戶登錄表單
'參 數:無
'=================================================
sub ShowUserLogin()
dim strLogin
If Session("UserName")="" Then
strLogin= "<table width='100%' border='0' cellspacing='0' cellpadding='0'>"
strLogin=strLogin & "<form action='UserLogin.asp' method='post' name='UserLogin' onSubmit='return CheckForm();'>"
strLogin=strLogin & "<tr><td height='25' align='right'>User name:</td><td height='25'><input name='UserName' type='text' id='UserName' size='10' maxlength='20'></td></tr>"
strLogin=strLogin & "<tr><td height='25' align='right'>Password:</td><td height='25'><input name='Password' type='password' id='Password' size='10' maxlength='20'></td></tr>"
strLogin=strLogin & "<tr align='center'><td height='25' colspan='2'><input name='Login' type='submit' id='Login' value=' Login '> <input name='Reset' type='reset' id='Reset' value=' Clear '>"
strLogin=strLogin & "</td></tr>"
strLogin=strLogin & "<tr><td height='20' align='center' colspan='2'><a href='UserReg.asp' target='_blank'>New User Register</a> <a href='GetPassword.asp' target='_blank'>Forget Password?</a></td></tr>"
strLogin=strLogin & "</form></table>"
response.write strLogin
%>
<script language=javascript>
function CheckForm()
{
if(document.UserLogin.UserName.value=="")
{
alert("please input User name!");
document.UserLogin.UserName.focus();
return false;
}
if(document.UserLogin.Password.value == "")
{
alert("please input password!");
document.UserLogin.Password.focus();
return false;
}
}
</script>
<%
Else
response.write "Welcome!" & Session("UserName") & "<br><br>"
response.write "<b>User control panel:</b><br><br> <a href='Server.asp'><b>Member center</b></a><br><br>"
end if
end sub
'=================================================
'過程名:ShowUserLogina
'作 用:顯示用戶登錄表單
'參 數:無
'=================================================
sub ShowUserLogina()
dim strLogin
If Session("UserName")="" Then
strLogin= "<table width='100%' border='0' cellspacing='0' cellpadding='0'>"
strLogin=strLogin & "<form action='UserLogina.asp' method='post' name='UserLogin' onSubmit='return CheckForm();'>"
strLogin=strLogin & "<tr><td height='25' align='right'>User name:</td><td height='25'><input name='UserName' type='text' id='UserName' size='10' maxlength='20'></td></tr>"
strLogin=strLogin & "<tr><td height='25' align='right'>Password:</td><td height='25'><input name='Password' type='password' id='Password' size='10' maxlength='20'></td></tr>"
strLogin=strLogin & "<tr align='center'><td height='25' colspan='2'><input name='Login' type='submit' id='Login' value=' Submit '> <input name='Reset' type='reset' id='Reset' value=' Clear '>"
strLogin=strLogin & "</td></tr>"
strLogin=strLogin & "<tr><td height='20' align='center' colspan='2'><a href='UserReg.asp' target='_blank'>New User Register</a> <a href='GetPassword.asp' target='_blank'>Forget password?</a></td></tr>"
strLogin=strLogin & "</form></table>"
response.write strLogin
%>
<script language=javascript>
function CheckForm()
{
if(document.UserLogin.UserName.value=="")
{
alert("Please input user name!");
document.UserLogin.UserName.focus();
return false;
}
if(document.UserLogin.Password.value == "")
{
alert("please input password!");
document.UserLogin.Password.focus();
return false;
}
}
</script>
<%
Else
response.write "Welcome!" & Session("UserName") & "<br><br>"
response.write "<b>user control panel:</b><br><br> <a href='Server.asp'><b>member center</b></a><br><br>"
end if
end sub
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -