********************************************* cart_frames.htm- <HTML>
- <FRAMESET COLS="30%,70%">
- <FRAME NAME="cart" SRC="about:blank"><!-- scrolling="yes">-->
- <FRAME NAME="products" SRC="products.htm">
- </FRAMESET>
- </HTML>
- ************************************************ products.htm
- <HTML>
- <HEAD><meta charset="UTF-8">
- <TITLE></TITLE>
- <SCRIPT>
- var items = new Array(20); // Max number of items allowed
- var numitems = 0;
- var dead = 0; // Needed for the adjustment sections added, Phil Karras
- function Item(d,c,q) {
- this.desc = d;
- this.price = c;
- this.quantity = q;
- }
- function additem(desc, price, quantity) {
- dead = 0;
- for(i=1; i<=numitems && !dead; ++i) { // Match? yes = done.
- if(desc == items[ i ].desc) {
- ++items[ i ].quantity;
- dead = 1;
- }
- }
- if(!dead) { // PK added needed to bypass this if above worked
- items[++numitems] = new Item(desc,price,quantity);
- }
- displaycart();
- }
- function displaycart() {
- var totalcost=0;
- with (parent.cart.document) {
- open();
- write("<HTML><body>");
- write("# items: " + numitems + "<br>");
- if (numitems==0) {
- write("No items ordered.</body></HTML>");
- close();
- return;
- }
- write("<TABLE BORDER=1><FORM NAME='form1'>");
- for(i=1;i<=numitems;i++) {
- if(items[ i ].quantity > 0) { // pk
- write("<TR><TD>");
- write("<INPUT NAME='qty' TYPE='TEXT' SIZE=2 VALUE=");
- write(items[ i ].quantity + "></TD>");
- write("<TD>" + items[ i ].desc + "</TD>");
- write("<TD>" + items[ i ].price + "</TD>");
- write("<TD>" + (items[ i ].price * items[ i ].quantity) + "</TD>");
- write("</TR>\n");
- }
- totalcost += (items[ i ].price * items[ i ].quantity);
- }
- write("<TR><TD COLSPAN=3><B>Total Cost:</B>");
- write("</TD><TD>" + totalcost + "</TD>");
- write("</TABLE>");
- write("<INPUT TYPE=BUTTON VALUE='Пересчет'");
- write("onClick='parent.products.updatecart();'>");
- write("<INPUT TYPE=BUTTON VALUE='Оформить'");
- write("onClick='parent.products.complete();'>"); // pk01
- write("</FORM></body></HTML>");
- close();
- }
- }
- function updatecart() {
- for (i=1; i<=numitems; i++) {
- items[ i ].quantity = parent.cart.document.form1.qty[i-1].value;
- }
- for (i=1; i<=numitems; ++i) { // fixed 07/02/2001
- var done = 0;
- while(items[ i ].quantity == 0 && !done) { // Got a Zero!
- for(j=i; j < numitems; ++j) { // remove it from the list!
- items[j] = items[j+1];
- }
- --numitems; // fix the item counter as well
- if(numitems < i)
- ++done;
- }
- }
- displaycart();
- }
- function complete() { OrdWin=window.open('cart_complete.htm','OrdWin');}
- </SCRIPT>
- </HEAD>
- <body onLoad="displaycart();">
- <UL>
- <LI><B>Price: $3.95</B>
- <A href="javascript:additem('WP 97', 3.95,1);">
- <B>ORDER NOW</B></A>
- <LI><B>Price: $9.95</B>
- <A href="javascript:additem('SP 97', 9.95,1);">
- <B>ORDER NOW</B></A>
- </UL>
- </BODY>
- </HTML>
- ************************************************ cart_complete.htm
- <HTML>
- <!-- Cart_complete.htm -->
- <head>
- </head>
- <BODY>
- <FORM NAME="form1" action="" method=post>
- <B>Your Name:</B>
- <INPUT TYPE="TEXT" NAME="realname" SIZE=25>
- <TABLE BORDER=1>
- <TR><TD>Quantity <TD>Item
- <TD>Unit Cost <TD>Total Cost</TR>
- <SCRIPT >
- var numitems = window.opener.numitems;
- var totcost = 0;
- for (i=1; i<=numitems; i++) {
- document.write("<TR><TD>" + window.opener.items[i].quantity);
- document.write("<TD>" + window.opener.items[i].desc);
- document.write("<TD>" + window.opener.items[i].price);
- cost = window.opener.items[i].price * window.opener.items[i].quantity;
- cost = Math.round(cost * 100) /100;
- totcost += cost;
- document.write("<TD>" + cost);
- document.write("</TR>\n");
- document.write("<INPUT type=hidden name='qty" + i + "'");
- document.write(" VALUE='" + window.opener.items[i].quantity + "'>\n");
- document.write("<INPUT type=hidden name='desc" + i + "'");
- document.write(" VALUE='" + window.opener.items[i].desc + "'>\n");
- document.write("<INPUT type=hidden name='price" + i + "'");
- document.write(" VALUE='" + window.opener.items[i].price + "'>\n");
- document.write("<INPUT type=hidden name='cost" + i + "'");
- document.write(" VALUE='" + cost + "'>\n");
- }
- document.write("<INPUT type=hidden name='Total-Items'");
- document.write(" VALUE='" + totcost + "'>\n");
- document.write("<TR><TD COLSPAN=3><B>Total Items Cost:</B>");
- document.write("<TD> $" + totcost + "</TR>");
- var tax = totcost * .05;
- document.write("<INPUT type=hidden name='Tax'");
- document.write(" VALUE='" + tax + "'>\n");
- document.write("<TR><TD COLSPAN=3><B>MD State Tax:</B>");
- document.write("<TD> $" + tax + "</TR>");
- var Shipping = 5;
- document.write("<INPUT type=hidden name='Shipping'");
- document.write(" VALUE='" + Shipping + "'>\n");
- document.write("<TR><TD COLSPAN=3><B>Shipping:</B>");
- document.write("<TD> $" + Shipping + "</TR>");
- var Final = totcost/1 + tax/1 + Shipping/1;
- document.write("<INPUT type=hidden name='FinalCost'");
- document.write(" VALUE='" + Final + "'>\n");
- document.write("<TR><TD COLSPAN=3><B>Final Cost:</B>");
- document.write("<TD> $" + Final + "</TR>");
- </SCRIPT>
- </TABLE>
- <INPUT TYPE="SUBMIT" VALUE="Submit Order">
- </FORM>
- </BODY>
- </HTML>
#7777
http://zip500.blogspot.com заказывайте любые приложения, у нас есть все комплектующие
#7777
fscom avia3.ru/fscom/fscom/fscom/
Подписаться на:
Комментарии к сообщению (Atom)
Комментариев нет:
Отправить комментарий
комментировать