實驗四:購物車頁面的實現和美化

購物車頁面的簡單實現及其美化
在這裏插入圖片描述

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;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章