Java Reference
In-Depth Information
}
function showBasket()
{
basketWindow = window.open('about:blank', 'shoppingBasket',
'width=400,height=350');
basketWindow.document.open();
var basketItem;
var containsItems = false;
basketWindow.document.write(“<h4>Your shopping basket contains :</h4>”);
for (var i = 0; i < stockItems.length; i++)
{
var stockItem = stockItems[i];
if (stockItem.quantity > 0)
{
basketWindow.document.write(stockItem.title + “ at “);
basketWindow.document.write(stockItem.price);
basketWindow.document.write(“&nbsp&nbsp&nbsp&nbsp”);
basketWindow.document.write(“<a href='' onclick='return “
+ “window.opener.removeItem(“ + i + “)'>”);
basketWindow.document.write(“Remove Item</a><br />”);
containsItems = true;
}
}
if (!containsItems)
{
basketWindow.document.write(“<h4>No items</h4>”);
}
basketWindow.document.close();
basketWindow.focus();
}
function StockItem(title, price)
{
this.title = title;
this.price = price;
this.quantity = 0;
}
</script>
</head>
<body>
<h2 align=”center”>
Online Book Buyer</h2>
<form name=”form1” action=”“>
<input type=”button” value=”Show Shopping Basket” onclick=”showBasket()”
name=”btnShowBasket” />
</form>
<p>
Click any of the images below for more details
</p>
Search WWH ::




Custom Search