|
清单 7 显示了 addToCartButtonHandler() 函数的实现,当点击商品的 Add to Cart 按钮时会调用这个函数:
清单 7. addToCartButtonHandler() 实现
[php]
/*
* Handles a click on an Item's "Add to Cart" button
*/
function addToCartButtonHandler() {
// 'this' is the button that was clicked.
// Obtain the item ID that was set on it, and
// add to the cart.
Cart.addItemToCart(this.itemId,displayCart);
}
...........
[/php] |
|