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

📄 showproduct.asp

📁 本实例为一个完整的网上购物商城的完整例子程序,里面有所以的源代码.希望对大家学习有用.
💻 ASP
字号:
<!--#include file="top.asp"-->
<%
id=request("id")
session("oldUrl")="./"
thisUrl="showproduct.asp"
session("oldUrl")=thisUrl&"?id="&id
%>
<%
id=Trim(Request("id"))
if not isnumeric(id)then
Response.Write "<script language=""javascript"">"
Response.Write "alert(""您提交非法的参数 \n\n即将跳转到首页 "");"
Response.Write "location.href=""index.asp"""
Response.Write "</script>"
End if
Set rs=Server.CreateObject("ADODB.RecordSet") 
sql="select * from 56770_product where id=" & id
rs.open sql,conn,1,2
if rs.eof then
response.write "<script language=""javascript"">"
response.write "parent.alert('请不要输入错误的ID..');"
response.write "self.location.href='index.asp';"
response.write "</script>"
response.end
end if
product_name=rs("product_name")
sort_name=rs("sort_name")
csort_name=rs("csort_name")
cx=rs("cx")
sprice=rs("sprice")
vprice=rs("vprice")
price=rs("price")
cprice=rs("cprice")
company=rs("company")
brand=rs("brand")
cinfo=rs("cinfo")
bzhuang=rs("bzhuang")
info=rs("info")
pic=rs("pic")
cpic=rs("cpic")
views=rs("views")
buys=rs("buys")
bianhao=rs("bianhao")
day0=rs("day")
rs.close
set rs=nothing
%>

<%
'将起观看次数加1
conn.execute "update 56770_product set views=views+1 where id=" & id
%>
<%
'读取广告内容
Set rsnews=Server.CreateObject("ADODB.RecordSet") 
sqlnews="select * from 56770_news where newstype='ps'"
rsnews.open sqlnews,conn,1,1
subject=rsnews("subject")
news=replace(rsnews("message"),chr(13),"<br>")
news=replace(news,chr(32),"&nbsp;")
rsnews.close
set rsnews=nothing
%>

<title><%=sitename%>--商品详细介绍</title>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#333333">
  <tr>
    <td width="195" valign="top" align="center" bgcolor="#FCFAFC"> 
      <table width="96%" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr> 
          <td align="center"> <a href="pic/<%=cpic%>" target="_blank"><img border="0" src="pic/<%=cpic%>" hspace="5" vspace="5" width="160" height="220"></a> 
          </td>
        </tr>
        <tr valign="top"> 
          <td height="40" align="center"> <a href="pic/<%=cpic%>" target="_blank"><img src="images/fangda.gif" width="60" height="22" border="0"></a><br>
            </td>
        </tr>
      </table>
    </td>
    <td width="555" bgcolor="#FFFFFF"> 
      <table width="506" border="0" cellspacing="0" cellpadding="3" align="center">
    <tr> 
                <td height="20" colspan="2" bgcolor="#FCFAFC">&nbsp;<img src="images/icon_love.gif">当前位置:<a href="showsort.asp?sort_name=<%=sort_name%>"><%=sort_name%></a> <img src="images/icon_point.gif"> <a href="showsort.asp?sort_name=<%=sort_name%>&csort_name=<%=csort_name%>"><%=csort_name%></a> <img src="images/icon_point.gif"> <%=product_name%></td>
              </tr>
              <tr> 
                <td height="30" colspan="2">&nbsp;<b><div style='font-size:10.5pt'><font color="#0F829E"><%=product_name%></font></div></b></td>
              </tr>
        <tr valign="top"> 
          <td width="304"> 
            <table width="96%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="20" colspan="2">&nbsp;<b>商品编号:</b><%=bianhao%></td>
              </tr>
              <tr> 
                <td height="20" colspan="2">&nbsp;<s><b>市场价:</b>¥<%=sprice%>元</s></td>
              </tr>
<%if cx=true  then %>
<tr>
<td height="20" colspan="2"><b>&nbsp;<b>特&nbsp;&nbsp;价:</b>¥<%=cprice%>元&nbsp;<b>节省:</b>¥<%=sprice-cprice%>元</td>
</tr>
<tr>
<td height="20" colspan="2"><b>&nbsp;<b>折&nbsp;&nbsp;扣:</b><FONT face=隶书 color=#ee3d11 size=3><EM><STRONG><%=left(cprice/sprice*100,2)%></STRONG></EM></FONT><FONT face=隶书 color=#ee3d11 size=1> %</font></td>
</tr>

<%else %>
<tr>
<td height="20" colspan="2"><b>&nbsp;<b>商城价:</b>¥<%=price%>元&nbsp;<b>节省:</b>¥<%=sprice-price%>元 </td>  
</tr>
<tr> 
                <td height="20" colspan="2">&nbsp;<font color=red><b>VIP价:</b>¥<%=vprice%>元</font>&nbsp;<b>节省:</b>¥<%=sprice-vprice%>元</td></td>
              </tr>   
<%end if %>
 
              <tr> 
                <td height="20" colspan="2">&nbsp;<b>点击热度:</b>&nbsp;<%=views%>&nbsp;<b>销售个数:</b>&nbsp;<%=buys%> </td>
              </tr>
            </table>
          </td>
          <td width="302" valign="top"> 
            <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
               <tr> 
                <td height="20" colspan="2"><b>规格:</b> &nbsp;<%=cinfo%>  </td>
              </tr>
              <tr> 
                <td height="20" colspan="2"><b>包装:</b> &nbsp;<%=bzhuang%> </td>
              </tr>
               <tr> 
                <td height="20" colspan="2"><b>品牌:</b> &nbsp;<%=brand%>  </td>
              </tr>
              <tr> 
                <td height="20" colspan="2"><b>出品公司:</b> &nbsp;<%=company%> </td>
              </tr>
              <tr> 
                <td height="20" colspan="2"><b>上市日期:</b> &nbsp;<%=day0%> </td>
              </tr>
            </table>
          </td>
        </tr>
        <tr> 
          <td height="30" colspan="2"><a href="Basket.asp?id=<%=id%>"><img src="images/oicn-order.gif" border="0" ></a> 
<a href=javascript:history.back()><img src="images/back.gif" border="0" ></a>
       </td>
        </tr>
        <tr bgcolor="#666666"> 
          <td height="1" colspan="2"></td>
        </tr>
	</table>
   <table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
             <tr> 
          <td height="2"></td>
              </tr>
              <tr> 
                <td valign="top" width="120">          
                      <%
                   info = replace(info,chr(13),"<br>")
                   info = replace(info,chr(32),"&nbsp;")
                    %>
             <img src="images/dot2.gif" width="27" height="27" align="absmiddle"><strong><font size="3"> 
            </font></strong><font size="3"><strong>产品介绍</strong></font> </td>
                <td width="10"></td><td valign="top"><font size="4"><%=info%></font></td>
              </tr>
</table>
   <table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
      <tr bgcolor="#666666"> 
          <td height="1" colspan="2"></td>
        </tr>
     </table>
         <table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
	
              <tr> 
          <td height="2"></td>
              </tr>
        <tr> 
          <td valign="top" width="120"> <img src="images/dot2.gif" width="27" height="27" align="absmiddle"><strong><font size="3"> 
            </font></strong><font size="3"><strong>订购说明</strong></font></td>
      <td width="10"></td><td><%=news%></td>
        </tr>
      </table>
   <table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
      <tr bgcolor="#666666"> 
          <td height="1" colspan="2"></td>
        </tr>
     </table>
<%
dim sql
dim CurPage
If Request.QueryString("CurPage")= "" or Request.QueryString("CurPage")= 0 then
CurPage = 1
Else
CurPage = CINT(Request.QueryString("CurPage"))
End If
display = CurPage
set rs=server.createobject("adodb.recordset")
if request("action")="save" then
        grade=request("grade")
if request("content")<>"" then
        content=replace(replace(replace(request("content"), "'","‘"), "<", "&lt; "), ">", "&gt; ")
end if
downid=request("id")
if request("content")="" then
  response.write "<script>alert('对不起!您没有填写评论内容!!');</script>"
end if
if session("truevote")<>downid then
        sql="select * from 56770_Dvote where (id is null)"
rs.open sql, conn, 1, 3
rs.addnew
if request("content")<>"" then
        rs("content")=content
end if
rs("downid")=downid
session("truevote")=downid
rs.update
rs.close
else
        response.write "<script>alert('对不起!五分钟之内此作品您只能评论一次!');</script>"
end if
end if
sql="select * from 56770_Dvote where downid="&request("id")&" order by id desc"
rs.open sql, conn, 1, 1
if rs.bof and rs.eof then
        V_num=0
pingrade=0
end if
%>
    <table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
        <td valign="top" width="120"> <img src="images/dot2.gif" width="27" height="27" align="absmiddle"><strong><font size="3"> 
            </font></strong><font size="3"><strong>最新评论</strong></font></td>
                 <td width="10"></td>   
<td>
            <table width="100%" border="0" cellspacing="0" cellpadding="3">
              <tr>
<td align="center">
<form method=POST action="showproduct.asp?id=<%=request("id")%>">
<input name=id type=hidden value='<%=Request("id")%>'>
<input type="hidden" name="action" value="save">
简短评论请在100字以内!

<textarea name="content" cols="30" class="smallinput"></textarea>

<input type=submit value=" 提 交 您 的 评 论 " name="cmdok" class="buttonface"></form>
</td>
</tr>
<tr>
<td>
<hr width="100%" size="1" align="center">
<%if rs.eof and rs.bof then%>
对不起!没有任何评论!
<%
else
'定义每页纪录条数
RS.PageSize=10
Dim TotalPages
TotalPages = RS.PageCount
If CurPage>RS.Pagecount Then
CurPage=RS.Pagecount
end if
RS.AbsolutePage=CurPage
rs.CacheSize = RS.PageSize
Dim Totalcount
Totalcount =INT(RS.recordcount)
StartPageNum=1
do while StartPageNum+10 <= CurPage
StartPageNum=StartPageNum+10
Loop

EndPageNum=StartPageNum+9
If EndPageNum>RS.Pagecount then EndPageNum=RS.Pagecount
%>          </td>
</tr>
<tr>
<td height="23">
<table board=0 width=100% align="center" cellspacing="0" cellpadding="0" border="0">
<%
I=0
p=RS.PageSize*(Curpage-1)
do while(Not RS.Eof)and(I<RS.PageSize)
p=p+1
%>
<tr>
<td width="100%" ><font color="green">☉</font> <%=rs("content")%></td>
</tr>
<tr>
<td colspan="1" valign="top" >...............................................</td>
</tr>
<%
I=I+1
RS.MoveNext
Loop
%>
</table>
</td>
</tr>
<tr>
<td height="23">
<table width="100%" border="0" cellspacing="0" cellpadding="3" align="center">
<tr>
<td>页次: <font color="#CC0000"><%=CurPage%></font>/<%=TotalPages%></td>
<td align="right"> 页数: <a href="showproduct.asp?CurPage=<%=StartPageNum-1%>&id=<%=request("id")%>"><<</a>
<% For I=StartPageNum to EndPageNum
if I<>CurPage then %>
        <a href="showproduct.asp?CurPage=<%=I%>&id=<%=request("id")%>"><%=I%></a>
<% else %>
<%=I%>
<% end if %>
<% Next %>
<% if EndPageNum<RS.Pagecount then %>
<a href="votebbs.asp?CurPage=<%=EndPageNum+1%>&id=<%=request("id")%>">更多...</a>
<%end if%>
<b>|</b> <a href="showproduct.asp?id=<%=request("id")%>">刷 新</a>&nbsp; </td>
</tr><%
end if
%>
</table>
</td>
</tr>

            </table>


          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<!--#include file="footer.asp"-->

⌨️ 快捷键说明

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