We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9d7152c commit 0f660beCopy full SHA for 0f660be
BookV3/web/pages/client/index.jsp
@@ -15,6 +15,18 @@
15
<%-- 静态包含 base标签、css样式、jQuery文件 --%>
16
<%@ include file="/pages/common/head.jsp"%>
17
<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>
30
</head>
31
<body>
32
@@ -79,7 +91,7 @@
79
91
<span class="sp2">${book.stock}</span>
80
92
</div>
81
93
<div class="book_add">
82
- <button class="addToCart">加入购物车</button>
94
+ <button bookId="${book.id}" class="addToCart">加入购物车</button>
83
95
84
96
85
97
0 commit comments