>php教程 >php手册 >购物车前台页面代码

购物车前台页面代码

WBOY
WBOY원래의
2016-06-07 11:43:531010검색

购物车前台页面代码, 这只是个小例子, 具体可以自由发挥
nbsp;html><br> <br> <br>     <meta> <br>     <title>购物车自动计价</title> <br>     <script></script><br>     <script><br /> $(function(){<br /> $(".se").change(function(oEven) {<br /> var num = $(this).find("option:selected").text();<br /> var price = $(this).parent().next().text();<br /> $(this).parent().next().next().text(num*price);<br /> GetInAll();//计算所有物品价格<br /> });<br /> })<br /> <br /> function GetInAll()<br /> {<br /> var len = $("#PriceTable tbody").children("tr").length;<br /> var priceCount=0;<br /> for(var i=0;i<len;i++)<br /> {<br /> // var tempData=rows[i];<br /> var price1 = $("#PriceTable tbody tr:eq("+i+") td:eq(4)").text();<br /> priceCount=parseFloat(priceCount)+parseFloat(price1);<br /> }<br /> $("#PriceTable tfoot tr td:eq(1)").text(priceCount);<br /> }<br /> </script><br>     <style><br /> table input[type=text]{ width:32px;}<br /> </style> <br> <br> <br> <br>     <div> <br>        <table> <br>          <thead><tr> <td>物品编号</td> <td>物品名称</td> <td>数量</td> <td>价格</td> <td>小计</td> </tr></thead> <br>          <tbody> <br>             <tr> <br>                 <td>jsp_123</td> <br>                 <td>电脑</td> <br>                 <td> <br>                     <select><br>                         <option>1</option> <br>                         <option>2</option> <br>                         <option>3</option> <br>                         <option>4</option> <br>                         <option>5</option> <br>                     </select><br>                 </td> <br>                 <td>1950</td> <br>                 <td>1950</td> <br>             </tr> <br>             <tr> <br>                 <td>jsp_123</td> <br>                 <td>电脑</td> <br>                 <td> <br>                     <select><br>                         <option>1</option> <br>                         <option>2</option> <br>                         <option>3</option> <br>                         <option>4</option> <br>                         <option>5</option> <br>                     </select><br>                 </td> <br>                 <td>1950</td> <br>                 <td>1950</td> <br>             </tr> <br>             <tr> <br>                 <td>jsp_123</td> <br>                 <td>电脑</td> <br>                 <td> <br>                     <select><br>                         <option>1</option> <br>                         <option>2</option> <br>                         <option>3</option> <br>                         <option>4</option> <br>                         <option>5</option> <br>                     </select><br>                 </td> <br>                 <td>1950</td> <br>                 <td>1950</td> <br>             </tr> <br>            <br>          </tbody> <br>          <tfoot> <br>            <tr> <td>总计:</td> <td>5850</td> </tr> <br>          </tfoot> <br>        </table> <br>     </div> <br>     <input><br> <br>

AD:真正免费,域名+虚机+企业邮箱=0元

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.