⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productclass.asp

📁 产品管理系统 <script language="JavaScript" src="js.asp?nclassid=1"> js.asp改成你的本文件的url nclassid可以改成cl
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="include/const.asp"-->
<%
	dim rs,sql
	dim classid, classname, nclassid, Nclassname
   	dim totalPut   
   	dim CurrentPage, TotalPages
   	if request("classid")<>"" then
		classid=request("classid")
   	else
		classid=0
   	end if
   	if not isempty(request("page")) then
      		currentPage=cint(request("page"))
   	else
      		currentPage=1
   	end if
  	set rs = server.createobject("adodb.recordset")
 	'set rs1=server.createobject("adodb.recordset")
   	if trim(request.querystring("nclassid"))<>"" then
		nclassid=int(request.querystring("nclassid"))
  		sql="select * from ANclass where NclassID="&cstr(nclassid)
 		rs.open sql,conn,1,1
 		if not rs.eof then
			Nclassname=rs("Nclass")
 		end if
		rs.close
   	else
		Nclassid=0
		Nclassname="全部产品"
   	end if
  	sql="select * from Aclass where classID="&cstr(classid)
 	rs.open sql,conn,1,1
 	if not rs.eof then
		classname=rs("class")
 	end if
	rs.close
%>
<html>
<head>
<meta NAME="GENERATOR" Content="Microsoft FrontPage 4.0">
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=gb2312">
<meta name="keywords" content="动网先锋,http://www.aspsky.net">
<LINK href="include/STYLE.CSS" rel=stylesheet>
<title><%=classname%></title>
</head>

<body>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td><!--#include file="head.inc" -->
</td>
  </tr>
  <tr> 
    <td><TABLE cellSpacing=0 cellPadding=4 width="100%" border=0 align=center>
        <TR> 
          <TD height="32" background="images/bg_2.gif"> <%
	sql="select class,classid from Aclass"
	rs.open sql,conn,1,1
	if rs.eof and rs.bof then
		response.write "还没有任何栏目"
	else
	do while not rs.eof
%>
            |&nbsp;&nbsp;<a href="default.asp?classid=<%=rs("classid")%>"> 
            <%if cint(rs("classid"))=cint(classid) then%>
            <font color=red><%=rs("class")%></font> 
            <%else%>
            <%=rs("class")%> 
            <%end if%>
            </a>&nbsp;&nbsp;|&nbsp;&nbsp; <%  
	rs.movenext  
	loop  
	end if  
	rs.close  
%> </TD>
        </TR>
        <TR> 
          <TD class="title2"> |&nbsp;&nbsp;<%=classname%>>> <%if Nclassid="" then%>
            全部产品 
            <%else%> <%=Nclassname%> <%end if%> </TD>
        </TR>
        <TR>
          <TD height="10"></TD>
        </TR>
      </table></td>
  </tr>
  <tr> 
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="170" valign="top"><TABLE  cellSpacing=0 cellPadding=4 width="98%" border=0>
              <TR> 
                <TD height="32" background="images/bg_2.gif">近期热门产品<b> 
                  </b></TD>
              </TR>
              <TR> 
                <TD class="tdbg"> <font style=line-height:150%> 
                  <%
function gotTopic(str,strlen)
	dim l,t,c, i
	l=len(str)
	t=0
	for i=1 to l
	c=Abs(Asc(Mid(str,i,1)))
	if c>255 then
	t=t+2
	else
	t=t+1
	end if
	if t>=strlen then
	gotTopic=left(str,i)&"..."
	exit for
	else
	gotTopic=str&" "
	end if
	next
end function

if nclassid=0 then hotkind=1
select case hotkind
	case "1" sql="SELECT top 10 * FROM product where DateDiff('d',dateandtime,date())<="&DateNum&" order by hits desc,title" 
	case "2" sql="SELECT top 10 * FROM product where DateDiff('d',dateandtime,date())<="&DateNum&" and Nclassid="& nclassid &" order by hits desc,title"
end select
	rs.open sql,conn,1,1 
	if rs.bof and rs.eof then 
		response.write "近期无更新产品" 
	else 
	do while not rs.eof   
%>
                  <li><a href="productview.asp?id=<%=rs("productid")%>" title="<%=rs("title")%>" target=_top><%=gottopic(rs("title"),25)%></a>[<font color=red><%=rs("hits")%></font>]<br>
                  <%  rs.movenext     
	loop
	end if  
	rs.close   
%>
                  </font> </TD>
              </TR>
              <TR> 
                <TD height="32" background="images/bg_2.gif">产品信息查询</TD>
              </TR>
              <TR> 
                <TD class="tdbg"> 
                  <!--#include file=query.asp-->
                </TD>
              </TR>
            </table></td>
          <td valign="top"><TABLE width="98%" border=0 align="center" cellPadding=0 cellSpacing=0>
              <TR> 
                <TD height="32" background="images/bg_2.gif">|&nbsp; 
                  <%if Nclassid=0 then%>
                  <%=Nclassname%>>> 
                  <%
	sql="select * from ANclass where classid="&classid
	rs.open sql,conn,1,1
	do while not rs.eof
		response.write "&nbsp;<a href=productclass.asp?classid="&classid&"&Nclassid="&rs("Nclassid")&">"&rs("Nclass")&"</a>"
	rs.movenext
	loop
	rs.close
else
%>
                  <font color=red><%=Nclassname%></font> 
                  <%
	sql="select * from ANclass where Nclassid<>"&Nclassid&" and classid="&classid
	rs.open sql,conn,1,1
	do while not rs.eof
		response.write "&nbsp;<a href=productclass.asp?classid="&classid&"&Nclassid="&rs("Nclassid")&">"&rs("Nclass")&"</a>"
	rs.movenext
	loop
	rs.close
%>
                  <%end if%>
                </TD>
              </TR>
              <TR> 
                <TD> <font style=line-height:150%> 
                  <% 
if Nclassid<>0 then
	sql="select * from product where Nclassid="+cstr(Nclassid)+" and classid="+cstr(classid)+"  order by productid desc" 
elseif classid<>0 then
	sql="select * from product where classid="+cstr(classid)+" order by productid desc" 
else
	sql="select * from product order by productid desc"
end if
	rs.open sql,conn,1,1 
  	if rs.eof and rs.bof then 
       		response.write "<p align='center'>没有或没有找到任何产品</p>" 
   	else 
      		totalPut=rs.recordcount 
      		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 
            		showContent 
            		showpage totalput,MaxPerPage,"productclass.asp" 
       		else 
          		if (currentPage-1)*MaxPerPage<totalPut then 
            			rs.move  (currentPage-1)*MaxPerPage 
            			showContent 
             			showpage totalput,MaxPerPage,"productclass.asp" 
        		else 
	        		currentPage=1 
           			showContent 
           			showpage totalput,MaxPerPage,"productclass.asp" 
	      		end if 
	   	end if 
   	rs.close 
   	end if 
	         
sub showContent 
       	dim i 
	   	i=0 
	do while not rs.eof
%>
                  </font> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td height="10"></td>
                    </tr>
                    <tr> 
                      <td height="5" background="images/bg.gif"></td>
                    </tr>
                    <tr> 
                      <td><table width="100%" border="0" cellspacing="3" cellpadding="1">
                          <tr> 
                            <td width="120"> <div align="center"> 
                                <% if rs("images")="" then %>
                                <a href="productview.asp?id=<%=rs("productid")%>"><img src="images/nopic.gif" border="0"></a> 
                                <%else%>
                                <a href="productview.asp?id=<%=rs("productid")%>"><img src="<%=rs("images")%>" border="0" width="95" height="95"></a> 
                                <%end if%>
                              </div></td>
                            <td><table width="98%" border="0" align="center" cellpadding="1" cellspacing="2">
                                <tr> 
                                  <td><strong>[<font style=line-height:150%><a href="productview.asp?id=<%=rs("productid")%>" title=<%=left(rs("Nkey"),30)%>><%=left(rs("title"),20)%>...</a></font>]<br>
                                    </strong><font style=line-height:150%><%=left(rs("content"),80)%>...</font><strong> 
                                    </strong></td>
                                </tr>
                                <tr> 
                                  <td><div align="right"><a href="productview.asp?id=<%=rs("productid")%>"><img src="images/1.gif" width="78" height="18" border="0"></a>&nbsp;&nbsp;</div></td>
                                </tr>
                              </table></td>
                            <td width="120">编号:<font style=line-height:150%><%=i+1%><br>
                              价格:<font style=line-height:150%> 
                              <%if not isnull(rs("price")) then%>
                              <%=rs("price")%> 
                              <%else%>
                              不详 
                              <%end if%>
                              </font> </font><br>
                              状态: <%if not isnull(rs("state")) then%> <%=rs("state")%> <%else%>
                              不详 
                              <%end if%> <br>
                              日期:( 
                              <%if rs("dateandtime")=date() then%> <font color=red><%=month(rs("dateandtime"))%>月<%=day(rs("dateandtime"))%>日</font> <%else%> <font color='#999999'><%=month(rs("dateandtime"))%>月<%=day(rs("dateandtime"))%>日</font> <%end if%>
                              )<br>
                              查看:<font color=green><%=rs("hits")%></font></td>
                          </tr>
                        </table> </td>
                    </tr>
                  </table>
                  <% 
	i=i+1
	if i>=MaxPerPage then exit do
	rs.movenext 
	loop 
end sub
%>
                  <div align="center"> 
                    <%
function showpage(totalnumber,maxperpage,filename)
  	dim n, i
  	if totalnumber mod maxperpage=0 then
     		n= totalnumber \ maxperpage
  	else
     		n= totalnumber \ maxperpage+1
  	end if
  	response.write "<form method=Post action="&filename&"?classid="&request("classid")&"&Nclassid="&request("Nclassid")&">"
  	response.write "<font color='red'>"&Nclassname&"</font>"

  	if CurrentPage<2 then
    		response.write "共"&totalnumber&"篇&nbsp;首页 上一页&nbsp;"
  	else
    		response.write "共"&totalnumber&"篇&nbsp;<a href="&filename&"?page=1&classid="&request("classid")&"&Nclassid="&request("Nclassid")&">首页</a>&nbsp;"
    		response.write "<a href="&filename&"?page="&CurrentPage-1&"&classid="&request("classid")&"&Nclassid="&request("Nclassid")&">上一页</a>&nbsp;"
  	end if

  	if n-currentpage<1 then
    		response.write "下一页 尾页"
  	else
    		response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&classid="&request("classid")&"&Nclassid="&request("Nclassid")&">"
    		response.write "下一页</a> <a href="&filename&"?page="&n&"&classid="&request("classid")&"&Nclassid="&request("Nclassid")&">尾页</a>"
  	end if
   	response.write "&nbsp;页次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
    	response.write "&nbsp;<b>"&maxperpage&"</b>篇产品/页 "
%>
                    转: 
                    <select name='page' size='1' onchange='javascript:submit()' class="smallinput" >
                      <%for i = 1 to n%>
                      <option value='<%=i%>' <%if cint(CurrentPage)=cint(i) then%> selected <%end if%>>第<%=i%>页</option>
                      <%next%>
                    </select>
                    <%     
end function

   	set rs=nothing   
	conn.close
	set conn=nothing
%>
                  </div> </TD>
              </TR>
            </table></td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr> 
    <td>&nbsp;</td>
  </tr>
  <tr> 
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<br>
<div align="center"> <center> </div>
<!--#include file="foot.inc" -->
</body>                              
</html>                              

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -