用户登录  |  用户注册
首 页商业源码原创产品编程论坛
当前位置:PB创新网文章中心编程技巧Delphi

都给你了,自己看着办吧!

减小字体 增大字体 作者:佚名  来源:本站整理  发布时间:2009-03-16 20:18:14
<%@ Language=VBScript %>
<!--#include file="inc/dbconn.inc"-->
<%
  ''--------------------------------------------------------------------
  ''
  '' file name :       eshop.asp
  ''
  '' Description:      显示商品信息
  ''
  '' date:             00-10-10 10:11
  ''
  '' Author:           雨天5377
  ''---------------------------------------------------------------------
dim sql,rs,categoryID,txtkey
''sql          ----SQL查询语句
''rs           ----返回记录集合
''category     ----商品类别编号

dim recordperpage,pagen,total,rc
''recordperpage----每一页显示的的数据项目数
''pagen        ----当前页为第几页
''total        ----总的页数
''rc           ----当前页的某一记录号

dim x
dim p_id,p_name,p_sprice,p_mprice,p_num,p_total
''p_id         ----商品编号
''p_name       ----商品名称
''p_sprice     ----原价
''p_mprice     ----会员价
''p_num        ----数量


''输出HTML
%>
<html>
<head>
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=gb2312">
<link REL="SHORTCUT ICON" href="http://200.200.200.9/xx.ico">
<LINK href="css/main.css" rel=stylesheet>
<title>E-SHOP</title>
<script language=javascript>
function OpenWinCart(url){
winCart= window.open(url,"winCart","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,top=30,left=200,height=302,width=532");      
winCart.focus() ;
}

</script>
</head>

<body bgcolor="#FFFFFF" background="images/line.jpg" leftmargin="5" topmargin="15" marginwidth="0" marginheight="0">
<table width="768" border="0">
  <tr>
    <td width="355"> </td>
    <td width="63" style="border-right: 1 solid #000000"> </td>
    <td width="63" style="border-right: 1 solid #000000"> </td>
    <td width="63" style="border-right: 1 solid #000000"> </td>
    <td width="63" style="border-right: 1 solid #000000"> </td>
    <td width="63" style="border-right: 1 solid #000000"> </td>
    <td width="87"> </td>
  </tr>
</table>
<table width="768" border="0" bgcolor="#000000" height="1" cellpadding="0" cellspacing="0">
  <tr><td></td></tr></table>

<table width="770" border="0" height="56" cellspacing="0" cellpadding="0">
  <tr>
    <td width="94">
      <div id="Layer1" style="position:absolute; width:123px; height:32px; z-index:1; left: 7px; top: 55px"><img src=http://www.newasp.net/images/NullPic.gif" width="133" height="41"></div>
    </td>
    <td width="695" valign="bottom">
      <table width="639" border="0" cellpadding="0" cellspacing="0" align="right">
        <tr bgcolor="#006633" align="center">
          <td height="18"> <font color="#FFFFFF">电脑通讯 家用电器 体育保健 礼品服务 儿童用品 时尚服装 </font></td>
        </tr>
        <tr bgcolor="#66CC33" align="center">
          <td height="18">图书音像 商务用品 服饰用品 医药保健 电脑软件 化妆用品 糖果饮料</td>
        </tr>
      </table>
    </td>
  </tr>
</table>

<table width="770" border="0">
  <tr>
    <td width="196"> </td>
    <td width="613"> <%
if session("loginID")<>"" then
   response.write("会员:"&session("username")&"  您好!"+VbCrLf)
end if
%> </td>
  </tr>
</table>

<table width="770" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="170" valign="top">
      <table width="170" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src=http://www.newasp.net/images/NullPic.gif" width="170" height="27"></td>
        </tr>
      </table>
<%
Response.Write("<script language=javascript src=""js/check.js""></script>" + vbCrLf)

''商品搜索部分
''response.write trim(request("select"))
if trim(request("select"))=""  then         ''如果是首次显示该页显示所有类别
   CategoryID=0
else
   CategoryID=cint(trim(request("select")))   ''否则按查询或上页显示类别显示
   if trim(request("txtkey"))<>"" then
      txtkey=replace(trim(request("txtkey")),"''","''''")     
   end if
end if

''''查询商品类别库
sql= "select * from category"
sql =sql&" Order By categoryID "
Set rs=cn.Execute(sql)    
%>
      <form name=sel method=post action=eshop.asp>
        <table width="160" border="0">
          <tr align="right">
            <td height="30"> 关键字:
              <input type="text" name="txtkey" size="15" value=<%=txtkey%>>
            </td>
          </tr>
          <tr align="right">
            <td height="30"> 按类别查询:  <%
response.write("  <select name=""select"" size=1>"+vbCrLf)
while Not Rs.EOF
response.write("  <option value=''"&rs("CategoryID")&"''")
if CategoryID=rs("CategoryID") then
    response.write(" selected")
end if
response.write(" >"&rs("Description")&"</option>"+vbCrLf)
rs.movenext
wend
set Rs=nothing
response.write("  </select>"+vbCrLf)
%> </td>
          </tr>
          <tr align="right">
            <td height="30">
              <input type=submit name=submit value=查询>
                 </td>
          </tr>
          <tr>
            <td height="30"><img src=http://www.newasp.net/images/NullPic.gif" width="160" height="17">
            </td>
          </tr>
          <tr align="center">
            <td height="30"><a href="member/register.asp">会员注册</a></td>
          </tr>
          <tr align="center">
            <td height="30"><a href=# onClick=OpenWinCart(''member/login_main.asp'')>会员登录</a></td>
          </tr>
          <tr align="center">
            <td height="30"><a href=# onclick=OpenWinCart(''member/back_1.asp'')>忘记密码</a></td>
          </tr>
          <tr align="center">
            <td height="30"><a href=# onclick=OpenWinCart(''checkbag.asp'')>查看购物车</a></td>
          </tr>
          <tr align="center">
            <td height="30"><a href=# onclick=OpenWinCart(''cartlist.asp'')>查看订单</a></td>
          </tr>
          <tr align="center">
            <td height="30">返回首页</td>
          </tr>
          <tr>
            <td height="30"><img src=http://www.newasp.net/images/NullPic.gif" width="160" height="17"></td>
          </tr>
        </table>
      </form>
      <table width="170" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td> <img src=http://www.newasp.net/images/NullPic.gif" width="170" height="27"></td>
        </tr>
      </table>
      
    </td>
    <td width="600" valign="top">
      <table width="600" border="0" cellspacing="0" cellpadding="0" background="images/e_bk.gif">
        <tr>
          <td width="600" height="30">
            <table width="35" border="0" cellspacing="0" cellpadding="0" align="left">
              <tr>
                <td> </td>
              </tr>
            </table>
            <%
''分页部分

''''查询数据库
set rs=Server.CreateObject("ADODB.Recordset")
select case CategoryID
case 0
if txtkey="" then
   sql = "Select productid,productname,price,Description,pdata,discount From Products"
else
   sql = "Select productid,productname,price,Description,pdata,discount From Products where productName like ''%"&txtkey&"%''"
''response.write sql
end if
case else
if txtkey="" then
   sql = "Select productid,productname,price,Description,pdata,discount From Products Where CategoryID=" & CategoryID
else
   sql = "Select productid,productname,price,Description,pdata,discount From Products Where CategoryID="&CategoryID&"and productName like ''%"&txtkey&"%''"
end if
end select
rs.open sql,cn,1,3    

recordperpage=5
rs.pagesize=recordperpage
total=rs.pagecount
if request("page")="" then
pagen=1
else
pagen=cint(request("page"))
end if

''''显示页码状况
response.write("<table align=left width=550 heigh=20>"+VbCrLf)
response.write(" <form action=""eshop.asp""  name=""ask4page"">"+VbCrLf)
response.write(" <input type=""hidden"" name=""txtkey"" value="""&txtkey&""">"+VbCrLf)
response.write(" <input type=""hidden"" name=""select"" value="""&CategoryID&""">"+VbCrLf)
response.write("  <tr>"+VbCrLf)
response.write("   <td noWrap>"+VbCrLf)
response.write("    <b>>>分页</b> "+VbCrLf)

''''''显示翻页链接
if ((total=0) or (pagen=1)) then
response.write("    <font color=#ffffff>首页</font> "+VbCrLf)
response.write("    <font color=#ffffff>前页</font> "+VbCrLf)
else
response.write("    <A href=javascript:viewPage(1,"&total&")>首页</a> "+VbCrLf)
response.write("    <A href=javascript:viewPage("&pagen-1&","&total&")>前页</a> "+VbCrLf)
end if

if ((total=0) or (pagen=total)) then
response.write("    <font color=#ffffff>后页</font> "+VbCrLf)
response.write("    <font color=#ffffff>尾页</font> "+VbCrLf)
else
response.write("    <A href=javascript:viewPage("&pagen+1&","&total&")>后页</a> "+VbCrLf)
response.write("    <A href=javascript:viewPage("&total&","&total&")>尾页</a> "+VbCrLf)
end if

''''''显示当前页号及分页情况
response.write("    页次: <b><font color=#ff0000>"&pagen&"</font></b>/<b>"&total&"</b>页 <b>"&recordperpage&"</b>项/页 "+VbCrLf)
response.write("    共<b>"&rs.recordcount&"</b>项商品"+VbCrLf)
response.write("   </td>"+VbCrLf)

''''''输入页号
response.write("   <td noWrap valign=center>"+VbCrLf)
response.write("    <div align=right>"+VbCrLf)
response.write("     转到:"+VbCrLf)
response.write("     <input  maxLength=10 name=Page size=5 value="&pagen&">"+VbCrLf)
response.write("     <input  language=javascript name=button1 onclick=viewPage(document.ask4page.Page.value,"&total&") type=button value=""Goto"">"+VbCrLf)
response.write("     </div>"+VbCrLf)
response.write("   </td>"+VbCrLf)
response.write("  </tr>"+VbCrLf)
response.write(" </form>"+VbCrLf)
response.write("</table>"+VbCrLf)

if not(rs.eof) then
rs.absolutepage=pagen
end if
rc=rs.pagesize
%> </td>
        </tr>
      </table>
      <table width="600" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="5" bgcolor="#006633">
          </td>
          <td width="595"> <br>
            <table width="550" border="0" cellspacing="0" cellpadding="0">
<%
''显示商品信息
if rs.eof then
   response.write "<center><b><font color=red>    对不起!没有找到您需要的商品!</font></b></center>"
end if
do while (not rs.eof and rc>0)
''SetForDisplay rs("Pic"), "image/gif"
x=rs("Description")

''输出商品的详细信息

%>
<form  action="put2bag.asp" name=putto target=winCart>
<tr>
  <td>
   <p align=center><u><%=rs("productname")%></u></p>
   <p>
   <img align=left border=0 hspace=7 src="showImg.asp?id=<%=rs("productID")%>" alt="<%=rs("productname")%>" vspace=5>     <%=x%><br>
   <font color=#cc0000>市场价</font>:<%=formatcurrency(rs("Price"))%>, <font color=#cc0000>会员价</font>:<%=formatcurrency(rs("Price")*0.1*rs("discount"))%><br>
   <input type=hidden name=''p_id'' value=''<%=rs(0)%>''></p>
   <input type=hidden name=''p_name'' value=''<%=rs("ProductName")%>''>
   <input type=hidden name=''p_sprice'' value=''<%=rs("Price")%>''>
   <input type=hidden name=''p_mprice'' value=''<%=rs("Price")*0.1*rs("discount")%>''>
   <div align=right>
   数量:<input type=text name=''p_num'' value=1 size=3>
   放入购物车:<input type=image width=20 heigh=20  alt=放入购物车  src=http://www.newasp.net/images/NullPic.gif onclick="OpenWinCart(''put2bag.asp'')" >
   </div><br>
  </td>
</tr>
</form>
<%
rc=rc-1
rs.movenext
loop
cn.close
set rs=nothing
set cn=nothing
%>
</table>
</td>
        </tr>
      </table>
      <table width="600" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src=http://www.newasp.net/images/NullPic.gif" width="579" height="37"></td>
        </tr>
      </table>
      <script language=javascript src="/js/bottom.js"></script>
    </td>
  </tr>
</table>
<div id="Layer2" style="position:absolute; width:200px; height:23px; z-index:2; left: 6px; top: 2px"><img src=http://www.newasp.net/images/NullPic.gif" width="315" height="32"></div>
<div id="Layer4" style="position:absolute; width:36px; height:58px; z-index:4; left: 711px; top: 66px"><img src=http://www.newasp.net/images/NullPic.gif" width="32" height="56"></div>
</body>
</html>

Tags:

作者:佚名

文章评论评论内容只代表网友观点,与本站立场无关!

   评论摘要(共 0 条,得分 0 分,平均 0 分) 查看完整评论
PB创新网ourmis.com】Copyright © 2000-2009 . All Rights Reserved .
页面执行时间:13,875.00000 毫秒
Email:ourmis@126.com QQ:2322888 蜀ICP备05006790号