Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adding up totals of order page

    Hey, I have a page with 3 iframes. The first iFrame displays a catalogue of books with a form to add the book (with a specified quantity) to the 2 iFrame (orderpage). I have a totals section at the top that I can't to work. Basically I need help creating some code that will update the total cost of books when a user adds any amount of books. I already have code that will add the book to the order page with the quantity.

    Here is what I have: Website

    Code for orders page.

    Code:
    <html><head><title>Untitled Document</title>
    
    
    
    <script type="text/javascript">
    
    function addbook(idx) {
    var books=parent.bookdisplay.books; 
    var str="<table>"+
        " <tr>"+
        "  <td>ISBN: <\/td>"+
        "  <td id='ISBN" + idx + "'>" + books[idx][0] + "<\/td>"+
        " <\/tr>"+
        " <tr>"+
        "  <td>Title: <\/td>"+
        "  <td id='TITLE" + idx + "'>" + books[idx][1] + "<\/td>"+
        " <\/tr>"+
        " </table>"+
      
      
        "<table>"+
        " <tr>"+
        "  <td>Price: <\/td>"+
        "  <td id='PRICE" + idx + "'> £" +  (books[idx][2]/100) + "<\/td>"+
        " <\/tr>"+
        " <tr>"+
        "  <td>Weight: <\/td>"+
        "  <td id='WEIGHT" + idx + "'>" +  books[idx][3] + "g<\/td>"+
        " <\/tr>"+
         " <tr>"+
        "  <td>Quantity: <\/td>"+
        "  <td id=''>" +  parent.bookdisplay.document.getElementsByName('quantity')[idx].value + "<\/td>"+
        " <\/tr>"+
        "<\/table>"+
        " <hr>";
    
    document.body.innerHTML+=str;
    
    }
    
    document.write("Total Cost of Books: £ " );
    document.write("<br>");
    document.write("Total Weight of Books: ");
    document.write("<br>");
    document.write("Total Postage Cost: £ ");
    document.write("<br>");
    document.write("Total Cost: £ ");
    
    </script></head><body>
    </body></html>
    I just need the code that will update the Total Cost Of Books part of the totals section.

    Thanks

  • #2
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Anyone?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •