...

View Full Version : Adding up totals of order page



Bullers
08-19-2008, 07:01 PM
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 (http://bookordering.tk)

Code for orders page.



<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

Bullers
08-20-2008, 03:57 PM
Anyone?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum