📄 commonsource.inc
字号:
<%
function setCartStatus(catID){
// Used to display the status for the cart in the upper right hand corner of the page
var result="";
var items = cart.selectNodes("//item");
var item = items.nextNode();
var total = 0;
var date = new Date();
while (item != null){
price = new Number(item.selectSingleNode("price").text);
quantity = new Number(item.selectSingleNode("quantity").text);
total += price * quantity;
item = items.nextNode();
}
total = Math.round(total * 100) / 100;
result = "<form><table width='100%'><tr><td rowspan='3' align='center'><font size='5'><B>The On-Line Superstore</B></font></td>";
result += "<td align='right'>Current Items:" + items.length + "</td></tr><tr><td align='right'>Current Total: $" + total;
result += "</td></tr><tr><td align='right'><input type='button' value='Go To Cart' onClick=navigate('displayCart.asp?catID=";
result += catID + "&dt=" + date.getTime() + "')></td></tr></table></form>";
Response.Write(result);
}
function buildNavPage(transformStart){
// Builds the navigation page with the categories on the left side of the page and
// the feature items on the right
var xslNode = menuTransform.selectSingleNode("//xsl:template[@match='categories']");
var result = "<table><tr><td width='40%' valign='top'>";
var transformCategories;
var transformFeature;
transformCategories = transformStart.selectSingleNode("categories");
result += transformCategories.transformNode(xslNode);
result += "</td><td width='60%'>"
xslNode = menuTransform.selectSingleNode("//xsl:template[@match='featureItems']");
transformFeature = transformStart.selectSingleNode("featureItems");
result += transformFeature.transformNode(xslNode);
result += "</td></tr></table>";
Response.Write(result);
}
function buildNavigate(){
var result = "<script Language='JavaScript'>function navigate(path){location.href = path;}</script>";
Response.Write(result);
}
function displayCart(catID){
//Transforms the cart and displays the results in the working area
var xslNode = menuTransform.selectSingleNode("//xsl:template[@match='cart']");
var result = "<form method='post' action='updateCart.asp?catID=" + catID + "'>";
var date = new Date();
result +=cart.documentElement.transformNode(xslNode);
result += "<input type='submit' value='Update Cart')>";
result += "<input type='button' value='Return' onClick=navigate('navPage.asp?catID=" + catID + "&dt=" + date.getTime() + "');>";
result += "<input type='button' value='Check Out' onClick=navigate('checkOut.asp?catID=" + catID + "')></form>";
Response.Write(result);
}
function displayNavigatePath(menuItem){
//Builds the navigational path of the categories used to get to the current category
var parentElement ;
var navigatePath = "";
var seperator="";
var date = new Date();
parentElement = menuItem.selectSingleNode("ancestor(category)");
while (parentElement != null){
navigatePath = "<td><a href='navPage.asp?catID=" + parentElement.getAttribute("catID") + "&dt=" + date.getTime() + "'>" + parentElement.getAttribute("products") + "</a>" + seperator + "</td>" + navigatePath;
parentElement = parentElement.selectSingleNode("ancestor(category)");
seperator=" :";
}
if (navigatePath != "")
navigatePath = "<table><tr><td>Navigate To:</td>" + navigatePath + "<td> : " + menuItem.getAttribute("products") + "</td></tr><tr><td> </td></tr></table>";
Response.Write(navigatePath);
}
function displayNavigatePathByID(catID){
var menuItem = catalogMenu.selectSingleNode("//category[@catID='" + catID + "']");
displayNavigatePath(menuItem);
}
function displayHeader(catID){
setCartStatus(catID);
displayNavigatePathByID(catID);
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -