标题:请帮我优化一下。谢谢
只看楼主
asbj
Rank: 1
等 级:新手上路
帖 子:54
专家分:0
注 册:2008-5-4
结帖率:78.57%
已结贴  问题点数:20 回复次数:2 
请帮我优化一下。谢谢
这个网页据说是非常占用资源,请大师帮助优化一下。谢谢。


<!--#include file="include/nowshop.asp" -->
<html><head><title>购物车-<%=sitename%>-<%=siteurl%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Robots" content="index,follow">
<LINK href="images/css.css" type=text/css rel=stylesheet>
<LINK href="list/newhead.css" type=text/css rel=stylesheet>
    <style type="text/css">
    <!--
     td{font-size:12px; font-family: "宋体"; line-height: 20px}
    input.buttonface {
        font-size: 12px; color: #000000; font-family: "宋体";  font-weight: bold
    }
    input.smallInput
    {
    font-size: 12px; height: 18px; color: #000000; font-family: "宋体"
    ; border: 1px #000000 solid
    }
    textarea.border
    {
    font-size: 12px; height: 60px; color: #000000; font-family: "宋体"
    ; border: 1px #000000 solid
    }
    .ab{font-size:12px; color:#FF0000; line-height:150%; font-weight: bold; font-family: "宋体"}
    .ba{font-size:12px; color:#ffffff; line-height:150%; font-family: "宋体"; font-weight: bold}
    .title1{font-size:12px; color:#000000; font-family: "宋体"; font-weight: bold}
    .title2{font-size:14px; color:#FF6600; font-family: "宋体"; font-weight: bold}
    .other{font-size:12px; color:#000000; font-family: "宋体"; font-weight: bold}
    .shich_zc {  font-size: 12px; line-height: 22px; color:#990000; text-decoration: none; ; font-family: "宋体"}
    .link {  font-size: 12px; text-decoration: underline; line-height: 12px; color:red; font-family: "宋体"}
    .style1 {  font-size: 18px; line-height: 12px; color:ff0000; font-family: "宋体"; font-weight: bold}
    .shich_cont {  text-decoration: line-through ; color:#000000; font-size: 12px; font-family: "宋体"}
    .form_font1{font-size:12px; color:#FF0000; font-family: "宋体"; font-weight: bold}
    .form_font2{font-size:12px; color:#FF9900; font-family: "宋体"; font-weight: bold}
    a:link {  color: #263487; text-decoration: none}
    a:visited {  color: #AB3033; text-decoration: none}
    a:hover { text-decoration: underline}
    .style2 {color: #581658}
    -->
    </style>

</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="20" onLoad="self.focus();">
<center>
  <!--#include file="top.asp"-->

  <%
call aspsql()
userkou=checkuserkou()
buylist=request.cookies("buyok")("cart")
if trim(request("del"))<>"" then
buylist=replace(buylist,trim(request("del")),"XXXXXXXX")
response.cookies("buyok")("cart")=buylist
end if
If Request("edit") = "ok" Then
buylist = ""
buyid = Split(Request("ProdId"), ", ")
For I=0 To UBound(buyid)
if i=0 then
buylist = "'" & buyid(I) & "', '"&request(buyid(I))&"'"
else
buylist = buylist & ", '" & buyid(I) & "', '"&request(buyid(I))&"'"
end if
Next
response.cookies("buyok")("cart") = buylist
End If
Set rs=conn.execute("select * from bproduc where ProdId in ("&buylist&") order by ProdId")
%>
<table width="768" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
      <td height="30"><table width="768" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td><img src="order/gouwuche/800buy_car_step.gif" width="160" height="48"></td>
            <td background="order/gouwuche/800buy_car_bg.gif"><img src="order/gouwuche/800buy_car_step7.gif" width="153" height="48"></td>
            <td background="order/gouwuche/800buy_car_bg.gif"><img src="order/gouwuche/800buy_car_step2.gif" width="153" height="48"></td>
            <td background="order/gouwuche/800buy_car_bg.gif"><img src="order/gouwuche/800buy_car_step8.gif" width="154" height="48"></td>
            <td><img src="order/gouwuche/800buy_car_step4.gif" width="108" height="48"></td>
          </tr>
        </table>
        <font color="#FF3333">&nbsp;</font></td>
    </tr>
<tr><td>
<table border="0" align="center" width="724" cellpadding="0" cellspacing="0">
          <form action="check.asp" method="POST" name="check">
            <tr align="center" bgcolor="#EEEEEE">
<td>
<table width="100%"  border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
                  <tr bgcolor="#f0f0f0">
                    <td height="22" align="center">商 品 名 称</td>
                    <td width="60" align="center">市场价</td>
                    <td width="60" align="center">优惠价</td>
                    <td width="60" align="center">会员价</td>
                    <td width="80" align="center">数 量</td>
                    <td width="80" align="center">优惠价小计</td>
                    <td width="60" align="center">获得积分</td>
                    <td width="60" align="center">删除</td>
                  </tr>
                  <%
Sum = 0
While Not rs.eof
buynum=split(replace(buylist,"'",""),", ")
for i=0 to ubound(buynum)
if rs("prodid")=buynum(i) then
Quatity=buynum(i+1)
exit for
end if
next
if not isNumeric(Quatity) then Quatity=1
If Quatity <= 0 Then Quatity = 1
Sum = Sum + csng(rs("PriceList"))*Quatity*checkuserkou()/10
shichangSum = shichangSum + csng(rs("PriceOrigin"))*Quatity*checkuserkou()/10
jifenSum = jifenSum + csng(rs("jifenzhi"))*Quatity
%>

                  <tr bgcolor="#FFFFFF">
                    <td height="20" align="center" valign="middle"><input type="hidden" name="ProdId" value="<%=rs("ProdId")%>">
                      <a href='list.asp?ProdId=<%=rs("ProdId")%>'><%=rs("ProdName")%></a></td>
                    <td align="center" class="shich_cont"><%=FormatNum(rs("PriceOrigin"),2)%></td>
                    <td align="center"><font color="#FF0000"><b><%=FormatNum(rs("PriceList"),2)%></b></font></td>
                    <td align="center"><font color="#FF0000"><b>
                      <%    if request.cookies("buyok")("userid")="" then
    response.write "<font color=red>"&huiyuanjia&"</font><br>"
    else
    response.write "<font color=red>"&FormatNum(rs("PriceList")*checkuserkou()/10,2)&"</font><br>"
    end if
%>
                      </b></font></td>
                    <td align="center"> <input type="Text" name="<%=rs("ProdId")%>" value="<%=Quatity%>" size="4" maxlength="4" class="smallInput" >
                      <input type="submit" name="order" value="修改"> </td>
                    <td align=center><font color="#FF0000"><%=FormatNum(rs("PriceList")*Quatity*checkuserkou()/10,2)%></font></td>
                    <td align=center><%=rs("jifenzhi")%></td>
                    <td align=center><a href=check.asp?del=<%=rs("ProdId")%>>删除</a></td>
                  </tr>
                  <%
rs.MoveNext
Wend
rs.close
set rs=nothing
%>
                </table>

</td>
            </tr>
            <tr align="left">
              <td colspan="6" bgcolor="#ffffff" height=35><table width="724" height="35" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="620">购物款总计:<font color="#FF0000">¥<%=FormatNum(Sum,2)%></font>
                        节省:<font color="#A72B31">¥<%=FormatNum(shichangsum-sum,2)%></font>
                       共获得积分:<font color="#FF0000"><%=jifensum%></font> </td>
                    <td>&nbsp;</td>
                  </tr>
                </table></td>
            </tr>
            <tr>
              <td colspan="6" bgcolor="#ffffff" height=40 align=center><table width="724" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                  <tr>
                    <td width="350">&nbsp; </td>
                    <td width="119" align="right"><a href="index.asp"><img src="order/gouwuche/800buy_gwc_jx.gif" alt="" width="125" height="39" border="0"></a></td>
                    <td width="40">&nbsp;</td>
                    <td width="259">
                      <% if request.cookies("buyok")("userid")="" then

      response.write "<a href=denglu.asp><img src=order/gouwuche/800buy_gwc_buy.gif width=125 height=39 border=0></a>"
        else
      response.write "<a href=payment.asp><img src=order/gouwuche/800buy_gwc_buy.gif width=125 height=39 border=0></a>"
        end if
        %>
                      <script>document.cookie='newyear_flag1=0;path=/cgi-bin';</script>
                      <input type="hidden" name="edit" value="ok"> </td>
                  </tr>
                </table></td>
            </tr>
            <tr>
              <td colspan="6" bgcolor="#ffffff" height=20 align=center> &nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; </td>
            </tr>
          </form>
        </table>
</td></tr></table>

  <!--#include file="down.asp"-->
</center>
</body></html>
<%
sum=FormatNum(sum,2)
response.cookies("buyok")("total")=sum
conn.close
set conn=nothing
%>
搜索更多相关主题的帖子: css 优化 content include follow 
2010-10-07 17:38
gupiao175
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:40
帖 子:1787
专家分:7527
注 册:2007-6-27
得分:20 
听说非常占资源,但是你自己测试过没有呢 ??占到哪里去了,是打开该页面速度非常慢还是你数据太大导致了慢呢?

你用的布局格式是TABLE,当然这并不代表你占的资源就一定多,根据表结构,感觉你显示的是数据,并没有什么错误!只要可以正常显示都不是问题,关键是你的数据库方面倒是需要考虑一下,数据量大的话就需要优化一下SQL语句!还有就是数据库本身用的是什么,是否有需要调整的地方呢?

Q:1428196631,百度:开发地 即可找到我,有事请留言!
2010-10-08 12:22
asbj
Rank: 1
等 级:新手上路
帖 子:54
专家分:0
注 册:2008-5-4
得分:0 
以下是引用gupiao175在2010-10-8 12:22:52的发言:

听说非常占资源,但是你自己测试过没有呢 ??占到哪里去了,是打开该页面速度非常慢还是你数据太大导致了慢呢?

你用的布局格式是TABLE,当然这并不代表你占的资源就一定多,根据表结构,感觉你显示的是数据,并没有什么错误!只要可以正常显示都不是问题,关键是你的数据库方面倒是需要考虑一下,数据量大的话就需要优化一下SQL语句!还有就是数据库本身用的是什么,是否有需要调整的地方呢?
服务器方面反映的,只要有人运行这个文件,服务器就出现卡死现象。
2010-10-08 18:19



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-322184-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020176 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved