主页面:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>制作简易的当当购物车页面</title>
<link type="text/css" rel="stylesheet" href="css/cartStyle.css" />
<script type="text/javascript" src="js/js.js"></script>
</head>
<body>
<div class="content">
<div class="logo">
<img src="images/dd_logo.jpg"><span onClick="close_frame()">关闭</span>
</div>
<div class="cartList">
<ul>
<li onClick="add_collection">移入收藏</li>
<li onClick="delete">删除</li>
<li onClick="add_collection">移入收藏</li>
<li onClick="delete">删除</li>
<li><span onClick="balance">结 算</span></li>
</ul>
</div>
</div>
</body>
</html>
js.js页面:
/**
*关闭
*/
function close_frame(){
window.close
}
/**
*收藏
*/
function add_collection(){
var ret = confirm("你是否将此物品加入到收藏");
if(ret){
alert("收藏成功");
}else{
alert("已经取消收藏")
}
}
/**
*结算
*/
function balance(){
var msg ="白岩松:白说 1 21.9 \n 岛上书店 1 24.6";
var ret = confirm(msg)
if(ret){
alert("购买成功");
}else{
alert("购买失败")
}
}
/**
*删除
*/
function delete(){
var ret = confirm("你是否确认删除");
if(ret){
alert("删除成功");
}else{
alert("取消删除")
}
}