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

📄 sub.asp

📁 网上购物系统
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%
'公用头部分
sub Header(title,nav)
	response.write	"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">"&_
					"<html xmlns=http://www.w3.org/1999/xhtml>"&_	
					"<head>"&_
					"<meta http-equiv=Content-Language content=zh-cn>"&_
					"<meta http-equiv=Content-Type content='text/html; charset=gb2312'>"&_
					"<title>"&title&"</title>"&_
					"</head>"&_
					"<body>"
	%>
	<!--#include file=Top.asp-->
	<!--#include file=left.asp-->
	<%
	response.write  "<div id=MainNav><h2>"&nav&"</h2></div>"
end sub


'整站公用下部
sub Footer()
	%>
	<!--#include file=End.asp-->
	<%
	response.write "</body></html>"
end sub

'*****************************************************************************
' 目的:    按商品特性显示最新商品列表
' 输入:    flag,RowNums,Row
' 说明:    flag:商品特性(1=新 2=荐 3=特);  NumsPerRow:每行商品数;  Rows:行数;
'*****************************************************************************
Sub prodIndexList(flag,NumsPerRow,Rows)
    if IsNumeric(NumsPerRow)=false or IsNumeric(Rows)=false then
        check="false"
    end if
    dim topnums
    topnums=NumsPerRow*Rows
    if check<>"false" then
        select case flag
        case 1
            title_txt="新品速递"
            sql="select top "&topnums&" id,prod_info_Name,prod_info_PriceM,prod_info_PriceS,prod_info_PicS from prod_info where prod_info_OnOff=0 and instr(prod_info_flag,1) order by id desc"
        case 2
             title_txt="精品推荐"
             sql="select top "&topnums&" id,prod_info_Name,prod_info_PriceM,prod_info_PriceS,prod_info_PicS from prod_info where prod_info_OnOff=0 and instr(prod_info_flag,2) order by id desc"
        case 3
             title_txt="特价商品"
             sql="select top "&topnums&" id,prod_info_Name,prod_info_PriceM,prod_info_PriceS,prod_info_PicS from prod_info where prod_info_OnOff=0 and instr(prod_info_flag,3) order by id desc"
        end select
        
        set rs=server.createobject("adodb.recordset")
        rs.open sql,conn,1,1
        if not rs.eof then 
            response.write  "<br>"&_
        					"<table border=0 width='100%' style='border-collapse: collapse' cellpadding=2>"&_
        					"	<tr>"&_
							"		<td class=RightHead><a href=prod_ListFlag.asp?flag="&flag&" class=U>最新"&title_txt&"</a></td>"&_
							"		<td class=RightHead align=right><a href=prod_ListFlag.asp?flag="&flag&" class=U><span style='font-weight: 400;padding-right:8px;'>更多"&title_txt&"</span></a></td>"&_
							"	</tr>"&_
							"</table>"&_
            				"<table border=0 width='100%' style='border-collapse: collapse' cellpadding=4><tr>"
           	i=1
            set id                  =rs(0)
            set prod_info_Name   =rs(1)
            set prod_info_PriceM =rs(2)
            set prod_info_PriceS =rs(3)
            set prod_info_PicS   =rs(4)
            xxx=1/NumsPerRow*100

            while not rs.eof
            response.write 	"		<td align=center width="&xxx&"% >"&_
                			"  			<table width='100%' border=0 align=center cellpadding=0 cellspacing=0 style='border-collapse: collapse'>"&_
                			"    			<tr>"&_
                		    "      				<td align=center valign=top>"&_
                 			"        				<a href=prod_Detail.asp?id="&id&"><img border=0 src=UPloadpic/"&prod_info_PicS&" onload='loaded(this,"&root_option_WidthSPic&","&root_option_HeighSPic&")' /></a><br>"&_
                 			"        				<a href=prod_Detail.asp?id="&id&">"&prod_info_Name&"</a><br />"&_
                 			"        				市场价:¥"&formatnumber(prod_info_PriceM,2,-1)&"<br>"&_
                 			"        				网站价:<b><font color=#FF6600>¥"&FormatNumber(prod_info_PriceS,2,-1)&"</font></b><br>"&_
                 			"						<a href=cart_add.asp?id="&id&" target=_blank><img src=images/icon_listcart.jpg border=0></a>&nbsp; &nbsp; <a href=prod_detail.asp?id="&id&" target=_blank><img src=images/icon_listDetail.jpg border=0></a>"&_
                 			"      				</td>"&_
                 			"    			</tr>"&_
                 			"  			</table>"&_
                 			"		</td>"

            if i mod NumsPerRow = 0 then
            response.write "	</tr>"
            end if
                
            rs.movenext
            i=i+1
            wend
            response.write  "</table>"
		end if
		response.write "<div class=brclass></div>"  
    else
        response.write "参数错误"
    end if
    rs.close
    set rs=nothing
end sub
'*********************************************************


'*************************************************************************************************
' 目的:    按商品类别-显示商品列表
' 输入:    cid,NumsPerPage,NumsPerRow
' 说明:    cid:商品类别id;  NumsPerPage:每页记录条数;  NumsPerRow:每行显示的商品数量;
'*************************************************************************************************
Sub prod_ListCategory(cid,NumsPerRow,NumsPerPage)
    if IsNumeric(cid)=false or IsNumeric(NumsPerRow)=false or IsNumeric(NumsPerPage)=false then
        check="false"
    end if
    if check<>"false" then
        response.write "<table cellspacing=0 cellpadding=2 style='border-collapse: collapse' width='100%'>"
        response.write "<tr align=center>"
        sql="select id,prod_info_Name,prod_info_PriceM,prod_info_PriceS,prod_info_PicS from prod_info where prod_info_OnOff=0 and cid="&cid&" order by id desc"
        'response.write sql
        'response.end
        
        set rs=server.createobject("adodb.recordset")
        rs.open sql,conn,1,1
        if rs.eof then 
            response.write "<td align=center>对不起,暂时没有相关商品信息!</td></tr></table>"
        else
            rs.PageSize =NumsPerPage '每页记录条数
		    iCount=rs.RecordCount '记录总数
	        iPageSize=rs.PageSize
    	    maxpage=rs.PageCount 
    	    page=request("page")
            if Not IsNumeric(page) or page="" then
                page=1
            else
                page=cint(page)
            end if
            if page<1 then
                page=1
            elseif  page>maxpage then
                page=maxpage
            end if
            rs.AbsolutePage=Page
	        if page=maxpage then
		        x=iCount-(maxpage-1)*iPageSize
	        else
		        x=iPageSize
	        end if
            i=1

            set id                  =rs(0)
            set prod_info_Name   =rs(1)
            set prod_info_PriceM =rs(2)
            set prod_info_PriceS =rs(3)
            set prod_info_PicS   =rs(4)
            xxx=1/NumsPerRow*100

            while not rs.eof and i<=rs.pagesize
                
            response.write 	"		<td align=center width="&xxx&"% >"&_
                			"  			<table width='100%' border=0 align=center cellpadding=0 cellspacing=0 style='border-collapse: collapse'>"&_
                			"    			<tr>"&_
                		    "      				<td align=center valign=top>"&_
                 			"        				<a href=prod_Detail.asp?id="&id&"><img border=0 src=UPloadpic/"&prod_info_PicS&" onload='loaded(this,"&root_option_WidthSPic&","&root_option_HeighSPic&")' /></a><br>"&_
                 			"        				<a href=prod_Detail.asp?id="&id&">"&prod_info_Name&"</a><br />"&_
                 			"        				市场价:¥"&formatnumber(prod_info_PriceM,2,-1)&"<br>"&_
                 			"        				网站价:<b><font color=#FF6600>¥"&FormatNumber(prod_info_PriceS,2,-1)&"</font></b>"&_
                 			"						<br><a href=cart_add.asp?id="&id&" target=_blank><img src=images/icon_listcart.jpg border=0></a>&nbsp; &nbsp; <a href=prod_detail.asp?id="&id&" target=_blank><img src=images/icon_listDetail.jpg border=0></a>"&_
                 			"      				</td>"&_
                 			"    			</tr>"&_
                 			"  			</table>"&_
                 			"		</td>"

                if i mod NumsPerRow = 0 then
                    response.write "</tr>"
                end if
                
                 rs.movenext
                 i=i+1
            wend
            call PageControl(iCount,maxpage,page)
            response.write "</table>"    
        end if
    else
        response.write "参数错误"
    end if
    rs.close
    set rs=nothing
end sub

⌨️ 快捷键说明

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