Skip to content

Commit 0f660be

Browse files
1
1 parent 9d7152c commit 0f660be

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

BookV3/web/pages/client/index.jsp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@
1515
<%-- 静态包含 base标签、css样式、jQuery文件 --%>
1616
<%@ include file="/pages/common/head.jsp"%>
1717
<link type="text/css" rel="stylesheet" href="static/css/style.css" >
18+
<Script type="text/javascript">
19+
$(function () {
20+
$("button.addToCart").click(function() {
21+
/*
22+
在事件响应的function函数中,有一个this对象,这个对象,是当前响应
23+
事件的dom对象
24+
*/
25+
var bookId = $(this).attr("bookId");
26+
location.href="http://local"
27+
})
28+
})
29+
</Script>
1830
</head>
1931
<body>
2032

@@ -79,7 +91,7 @@
7991
<span class="sp2">${book.stock}</span>
8092
</div>
8193
<div class="book_add">
82-
<button class="addToCart">加入购物车</button>
94+
<button bookId="${book.id}" class="addToCart">加入购物车</button>
8395
</div>
8496
</div>
8597
</div>

0 commit comments

Comments
 (0)