...

View Full Version : moving array info



Gez
08-15-2008, 07:00 PM
I have one page with 3 iFrames in, each iFrame links to 3 seperate html. files, the code is as follows:



<html>
<head>
<title>Book Ordering System</title>
</head>
<body text="white" bgcolor="#666666" scroll="no">
<br>
<frameset>
<table width = "990" height = "500" border="0" bgcolor="#CCCCCC" align="center">
<tr>
<td align="center"><iframe name="bookdisplay" height="462" src="bookdisplay.html"></iframe></td>
<td align="center"><iframe name="orderdisplay" height="462" src="orderdisplay.html"></iframe></td>
<td align="center"><iframe name="search" height="462" src="search.html"></iframe></td>
</tr>
</table>
</frameset>
</body>
</html>


The frame on the left (book display) is suppost to show a list of all books found in the array called 'catalogue', which this does sucessfully, code follows :


<html>
<head>
<title>Untitled Document</title>
</head>
<body bgcolor="#FFFFFF">
<script type="text/javascript">

// define the catalogue
var catalogue= new Array();
catalogue[0]= new Array(3765834619,"Neuro-linguistic Programming for Dummies",12.99,950);
catalogue[1]= new Array(5673423435,"Excel 2007 VBA Programming for Dummies",11.99,900);
catalogue[2]= new Array(7454982674,"The Forgotten Garden",9.99,450);
catalogue[3]= new Array(8356583865,"The Road Home",9.99,500);
catalogue[4]= new Array(1629546824,"No Time For Goodbye",10.99,600);
catalogue[5]= new Array(3547975624,"The Outcast",10.99,670);
catalogue[6]= new Array(1348795463,"How to Write Songs on Guitar",15.99,1010);
catalogue[7]= new Array(5673519472,"Fretboard Roadmaps",12.992,2700),
catalogue[8]= new Array(2730471465,"Management and Organisational Behaviour",20.99,1000);
catalogue[9]= new Array(4859716360,"Leadership Coaching",18.99,900);
catalogue[10]= new Array(8455327034,"AA pocket world atlas",10.99,1000);
catalogue[11]= new Array(7004367823,"The Years of Extermination ",8.99,450);
catalogue[12]= new Array(6723002893,"Eden's Outcasts",10.99,900);
catalogue[13]= new Array(5749438430,"What God Hath Wrought",10.99,800);
catalogue[14]= new Array(6758465435,"Time and Materials",10.99,760);
catalogue[15]= new Array(4356358907,"The Brief Wondrous Life of Oscar Wao",7.99,350);
catalogue[16]= new Array(5837593750,"Harry Potter and the Deathly Hallows ",9.99,900);
catalogue[17]= new Array(5759375974,"The World Without Us ",12.99,700);
catalogue[18]= new Array(5847594738,"The Dangerous Book for Boys ",17.99,780);
catalogue[19]= new Array(1477837381,"Deceptively Delicious",14.99,654);
catalogue[20]= new Array(4543568745,"Dead Certain",14.99,500);
catalogue[21]= new Array(7666834290,"Legacy of Ashes",11.99,1200);

function show_books(){

for ( i = 0; i < catalogue.length ; i++){

document.write("<table>");
document.write(" <tr>");
document.write(" <td>" + catalogue[i][0] + "</td>");
document.write(" </tr>");
document.write(" <tr>");
document.write(" <td>" + catalogue[i][1] + "</td>");
document.write(" </tr>");
document.write(" </table>");


document.write("<table>");
document.write(" <tr>");
document.write(" <td>Price: </td>");
document.write(" <td>&#163;" + catalogue[i][2] + "</td>");
document.write(" </tr>");
document.write(" <tr>");
document.write(" <td>Weight: </td>");
document.write(" <td>" + catalogue[i][3] + "g</td>");
document.write(" </tr>");
document.write("</table>");

document.write("<table>");
document.write(" <tr>");
document.write(" <td>");
document.write(" <form name='addtoorder'>");
document.write("Quantity: <input type='text' width='2' name='quantity' value='1'/>");
document.write(" </td>");
document.write(" <td>");
document.write(" <input type='submit' value='Add to Order' onclick=''");
document.write(" </td>");
document.write("</form>");
document.write(" </tr>");
document.write("<table>");

document.write(" ----------------------------");

}

}
show_books();

</script>
</body>
</html>

Now i need (when the button is pressed) to get the data for that book and the quantity that is typed into the text box to be outputted onto the middle iFrame (displayorder) with the ability to output asmany or aslittle books. i was thinking maybe taking the values from the catalogue array and writing it to a new array called order on the display order page but i have no idea how to do this? any ideas?

thanks
Gez

Gez
08-16-2008, 01:43 PM
anyone?

ninnypants
08-16-2008, 06:26 PM
You'll need to write it to a cookie if you want to pass it to another page



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum