еее
#7777
    http://zip500.blogspot.com заказывайте любые приложения, у нас есть все комплектующие

    fscom avia3.ru/fscom/fscom/fscom/


    1. ********************************************* cart_frames.htm
    2. <HTML>
    3. <FRAMESET COLS="30%,70%">
    4. <FRAME NAME="cart" SRC="about:blank"><!-- scrolling="yes">-->
    5. <FRAME NAME="products" SRC="products.htm">
    6. </FRAMESET>
    7. </HTML>
    8. ************************************************ products.htm
    9. <HTML>
    10. <HEAD><meta charset="UTF-8">
    11. <TITLE></TITLE>
    12. <SCRIPT>
    13. var items = new Array(20); // Max number of items allowed
    14. var numitems = 0;
    15. var dead = 0; // Needed for the adjustment sections added, Phil Karras
    16. function Item(d,c,q) {
    17.    this.desc = d;
    18.    this.price = c;
    19.    this.quantity = q;
    20. }
    21. function additem(desc, price, quantity) {
    22.    dead = 0;
    23.    for(i=1; i<=numitems && !dead; ++i) { // Match? yes = done.
    24.       if(desc == items[ i ].desc) {
    25.          ++items[ i ].quantity;
    26.          dead = 1;
    27.       }
    28.    }
    29.    if(!dead) { // PK added needed to bypass this if above worked
    30.       items[++numitems] = new Item(desc,price,quantity);
    31.    }
    32.    displaycart();
    33. }
    34. function displaycart() {
    35.    var totalcost=0;
    36.    with (parent.cart.document) {
    37.       open();
    38.       write("<HTML><body>"); 
    39.       write("# items: " + numitems + "<br>");
    40.       if (numitems==0) {
    41.          write("No items ordered.</body></HTML>");
    42.          close();
    43.          return;
    44.       }
    45.       write("<TABLE BORDER=1><FORM NAME='form1'>");
    46.       for(i=1;i<=numitems;i++) {
    47.          if(items[ i ].quantity > 0) { // pk
    48.             write("<TR><TD>");
    49.             write("<INPUT NAME='qty' TYPE='TEXT' SIZE=2 VALUE=");
    50.             write(items[ i ].quantity + "></TD>");
    51.             write("<TD>" + items[ i ].desc + "</TD>");
    52.             write("<TD>" + items[ i ].price + "</TD>");
    53.             write("<TD>" + (items[ i ].price * items[ i ].quantity) + "</TD>");
    54.             write("</TR>\n");
    55.          }
    56.          totalcost += (items[ i ].price * items[ i ].quantity);
    57.       }
    58.       write("<TR><TD COLSPAN=3><B>Total Cost:</B>");
    59.       write("</TD><TD>" + totalcost + "</TD>");
    60.       write("</TABLE>");
    61.       write("<INPUT TYPE=BUTTON VALUE='Пересчет'");
    62.       write("onClick='parent.products.updatecart();'>");
    63.       write("<INPUT TYPE=BUTTON VALUE='Оформить'");
    64.       write("onClick='parent.products.complete();'>"); // pk01
    65. write("</FORM></body></HTML>");
    66.       close();
    67.    }
    68. }
    69. function updatecart() {
    70.    for (i=1; i<=numitems; i++) {
    71.          items[ i ].quantity = parent.cart.document.form1.qty[i-1].value;
    72.    }
    73.    for (i=1; i<=numitems; ++i) {        // fixed 07/02/2001
    74.       var done = 0;
    75.       while(items[ i ].quantity == 0 && !done) { // Got a Zero!
    76.          for(j=i; j < numitems; ++j) {  // remove it from the list!
    77.             items[j] = items[j+1];
    78.          }
    79.          --numitems;                    // fix the item counter as well
    80.          if(numitems < i)
    81.             ++done;
    82.       }
    83.    }
    84.    displaycart();
    85. }
    86. function complete() { OrdWin=window.open('cart_complete.htm','OrdWin');}
    87. </SCRIPT>
    88. </HEAD>
    89. <body onLoad="displaycart();"> 
    90. <UL>
    91. <LI><B>Price: $3.95</B>
    92. <A href="javascript:additem('WP 97', 3.95,1);">
    93. <B>ORDER NOW</B></A>
    94. <LI><B>Price: $9.95</B>
    95. <A href="javascript:additem('SP 97', 9.95,1);">
    96. <B>ORDER NOW</B></A>
    97. </UL>
    98. </BODY>
    99. </HTML>
    100. ************************************************ cart_complete.htm
    101. <HTML>
    102. <!-- Cart_complete.htm -->
    103. <head>
    104. </head>
    105. <BODY>
    106. <FORM NAME="form1" action="" method=post>
    107. <B>Your Name:</B>
    108. <INPUT TYPE="TEXT" NAME="realname" SIZE=25>      
    109. <TABLE BORDER=1>
    110. <TR><TD>Quantity <TD>Item
    111. <TD>Unit Cost <TD>Total Cost</TR>
    112. <SCRIPT >
    113. var numitems = window.opener.numitems;
    114. var totcost = 0;
    115. for (i=1; i<=numitems; i++) {
    116.    document.write("<TR><TD>" + window.opener.items[i].quantity);
    117.    document.write("<TD>" + window.opener.items[i].desc);
    118.    document.write("<TD>" + window.opener.items[i].price);
    119.    cost = window.opener.items[i].price * window.opener.items[i].quantity;
    120.    cost = Math.round(cost * 100) /100;
    121.    totcost += cost;
    122.    document.write("<TD>" + cost);
    123.    document.write("</TR>\n");
    124.    document.write("<INPUT type=hidden name='qty" + i + "'");
    125.    document.write(" VALUE='" + window.opener.items[i].quantity + "'>\n");
    126.    document.write("<INPUT type=hidden name='desc" + i + "'");
    127.    document.write(" VALUE='" + window.opener.items[i].desc + "'>\n");
    128.    document.write("<INPUT type=hidden name='price" + i + "'");
    129.    document.write(" VALUE='" + window.opener.items[i].price + "'>\n");
    130.    document.write("<INPUT type=hidden name='cost" + i + "'");
    131.    document.write(" VALUE='" + cost + "'>\n");
    132. }
    133. document.write("<INPUT type=hidden name='Total-Items'");
    134. document.write(" VALUE='" + totcost + "'>\n");
    135. document.write("<TR><TD COLSPAN=3><B>Total Items Cost:</B>");
    136. document.write("<TD> $" + totcost + "</TR>");
    137. var tax = totcost * .05;
    138. document.write("<INPUT type=hidden name='Tax'");
    139. document.write(" VALUE='" + tax + "'>\n");
    140. document.write("<TR><TD COLSPAN=3><B>MD State Tax:</B>");
    141. document.write("<TD> $" + tax + "</TR>");
    142. var Shipping = 5;
    143. document.write("<INPUT type=hidden name='Shipping'");
    144. document.write(" VALUE='" + Shipping + "'>\n");
    145. document.write("<TR><TD COLSPAN=3><B>Shipping:</B>");
    146. document.write("<TD> $" + Shipping + "</TR>");
    147. var Final = totcost/1 + tax/1 + Shipping/1;
    148. document.write("<INPUT type=hidden name='FinalCost'");
    149. document.write(" VALUE='" + Final + "'>\n");
    150. document.write("<TR><TD COLSPAN=3><B>Final Cost:</B>");
    151. document.write("<TD> $" + Final + "</TR>");
    152. </SCRIPT>
    153. </TABLE>
    154. <INPUT TYPE="SUBMIT" VALUE="Submit Order">
    155. </FORM>
    156. </BODY>
    157. </HTML>
    #7777

    Комментариев нет:

    Отправить комментарий

    комментировать