购物车页面的简单实现及其美化
html代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>叮当图书网-查看购物车</title>
<link rel="stylesheet" href="shopping.css">
<style type="text/css">
div{
text-align:right;
}
#id1{
float:left;
}
</style>
</head>
<body>
<form>
<table>
<tr>
<td><input name="px" type="checkbox" value="1" id="allcheck" οnclick="selectAll()"/>全选</td>
<td></td>
<td>书籍名称</td>
<td>单价(元)</td>
<td>数量</td>
<td>小计(元)</td>
<td>操作</td>
</tr>
<tr>
<td><input name="select" type="checkbox" οnclick="selectSingle()"/></td>
<td class="td1"><img src="images/1.jpg" width="100" height="80"></td>
<td><a href="https://www.taobao.com/">零基础学设计</a></td>
<td >$52.70</td>
<td class="td1">
<input type="button" value="-" οnclick="jian1()"/>
<input type="text" value="1" id="shang1"/>
<input type="button" value="+" οnclick="jia1()"/>
</td>
<td>
<input type="text" value="52.70" id="priceall1">
</td>
<td><input type="button" value="删除"></td>
</tr>
<tr>
<td><input name="select" type="checkbox" οnclick= "selectSingle()"/></td>
<td class="td1"><img src="images/2.jpg" width="150" height="200"></img></td>
<td><a href="https://www.taobao.com/">JSP程序设计教程</a></td>
<td >$40.00</td>
<td class="td1">
<input type="button" value="-" οnclick="jian()"/>
<input type="text" value="1" id="shang"/>
<input type="button" value="+" οnclick="jia()" />
</td>
<td><input type="text" value="40.00" id="priceall"></td>
<td><input type="button" value="删除"></td>
</tr>
</table>
<div>
<button class="td2" id="id1">批量删除</button>
<p>商品总价(不含运费):<input type="text" value="92.70" id="all">元</p>
<button class="td2">立即购买</button>
</div>
</form>
<script src="myCar.js"></script>
</body>
</html>
css代码美化:
@charset "UTF-8";
table{
width:100%;
text-align:center;
border-collapse:collapse;
}
tr:nth-of-type(odd){
color:#009900;
}
tr:nth-of-type(even){
color:#00FF33;
}
table tr td{
border-right:1px solid blue;
border-top:1px solid #6699FF;
border-bottom:1px solid #6699FF;
border-left:1px solid #6666FF;
}
tr:first-child td{border-right:none;}
tr td a{
text-decoration:none;
}
.td1{
line-height:15%;
width:20%;
}
.td2{
width:10%
background-color:orange;
font-size:15px;
border:none;
}
a:hover{
background-color:yellow;
color:balck;
}
.td2:hover{
background-color:yellow;
color:balck;
}