亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

JavaScript開(kāi)發(fā)購(gòu)物車之購(gòu)物車展示頁(yè)

本節(jié)建立一個(gè)購(gòu)物車展示頁(yè)面

展示商品圖片,商品內(nèi)容描述,商品數(shù)量選擇,商品單價(jià)

商品價(jià)格小計(jì),商品刪除操作,以及商品總價(jià)格計(jì)算。

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?標(biāo)題: 購(gòu)物車
跳轉(zhuǎn)列表頁(yè)
?表頭:顯示各種資訊名稱如:圖片,描述,單價(jià),選擇等

# 內(nèi)容:選取的商品的資訊與動(dòng)作


顯示總價(jià)

#使用<h2>定義標(biāo)題為購(gòu)物車

<table>定義HTML 表格。

<thead>展示表格頭部,<tr> 元素定義表格行,<th> 元素定義表頭,裡麵包含圖片,描述,數(shù)量,單價(jià),小計(jì),操作等

<tbody>展示表格內(nèi)容部分,<tr><td>元素定義表格單元,顯示商品的內(nèi)容。

<button>標(biāo)籤來(lái)建立「 + 」「 - 」按鍵,中間使用<input type="text">來(lái)顯示數(shù)量。

底部表格外顯示總價(jià)。

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>購(gòu)物車</title>
  <!--購(gòu)物車樣式表-->
  <style>
    h2{
      text-align: center;
    }
    table{
      margin: auto;
      width: 90%;
      border-color: inherit;
    }
    th{
      color: white;
      font-weight: bold;
      font-family: 微軟雅黑,宋體;
    }
    img{
      height: 60%;
      display: block;
      margin: auto;
    }
    input{
      text-align: center;
      font-weight: bold;
    }
    button{
      font-weight: bold;
      font-size: 13px;
    }
  </style>
</head>
<body>
<div class="container">
  <h2>購(gòu)物車</h2>
  <h3><a href="list.php">返回商品列表頁(yè)面</a></h3>
  <table id="table" border="1" cellspacing="0" cellpadding="0" class="hide">
    <thead>
    <tr style="background-color: #87adbf;">
      <th>
        <input type="checkbox" id="allCheck" class="ck" />全選
      </th>
      <th>圖片</th>
      <th>描述</th>
      <th>數(shù)量</th>
      <th>單價(jià)</th>
      <th>小計(jì)</th>
      <th>操作</th>
    </tr>
    </thead>
    <tbody id="tbody">
    <!--
    <tr>
      <td><input type="checkbox" class="ck" /></td>
      <td>
       <img src="https://img.php.cn/upload/course/000/000/008/58297ff26fd94666.jpg" alt="" />
      </td>
      <td>純機(jī)械,超酷表帶</td>
      <td>
       <button style="width:100%;"class="down">-</button>
       <input style="width:100%;" type="text" value="1" readonly="readonly" />
       <button class="up">+</button>
      </td>
      <td>¥<span>3567</span></td>
      <td>¥<span>3567</span></td>
      <td><button class="del">刪除</button></td>
    </tr>
    -->
    </tbody>
  </table>
  <div class="box" id="box"></div>
  <h2 id="h2" class="">總價(jià)格:¥<span id="totalPrice">0</span></h2>
</div>
</body>
</html>

這樣我們就建立了一個(gè)簡(jiǎn)單的購(gòu)物車頁(yè)面cart.php檔案。

繼續(xù)學(xué)習(xí)
||
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>購(gòu)物車</title> <!--購(gòu)物車樣式表--> <style> h2{ text-align: center; } table{ margin: auto; width: 90%; border-color: inherit; } th{ color: white; font-weight: bold; font-family: 微軟雅黑,宋體; } img{ height: 60%; display: block; margin: auto; } input{ text-align: center; font-weight: bold; } button{ font-weight: bold; font-size: 13px; } </style> </head> <body> <div class="container"> <h2>購(gòu)物車</h2> <h3><a href="list.php">返回商品列表頁(yè)面</a></h3> <table id="table" border="1" cellspacing="0" cellpadding="0" class="hide"> <thead> <tr style="background-color: #87adbf;"> <th> <input type="checkbox" id="allCheck" class="ck" />全選 </th> <th>圖片</th> <th>描述</th> <th>數(shù)量</th> <th>單價(jià)</th> <th>小計(jì)</th> <th>操作</th> </tr> </thead> <tbody id="tbody"> <tr> <td><input type="checkbox" class="ck" /></td> <td> <img src="https://img.php.cn/upload/course/000/000/008/58297ff26fd94666.jpg" alt="" /> </td> <td>純機(jī)械,超酷表帶</td> <td> <button style="width:100%;"class="down">-</button> <input style="width:100%;" type="text" value="1" readonly="readonly" /> ?<button class="up">+</button> </td> <td>¥<span>3567</span></td> <td>¥<span>3567</span></td> <td><button class="del">刪除</button></td> </tr> </tbody> </table> <div class="box" id="box"></div> <h2 id="h2" class="">總價(jià)格:¥<span id="totalPrice">0</span></h2> </div> </body> </html>
提交重置程式碼