Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Object doesn't support this action.....


Message #1 by "Phil Perks" <philp@w...> on Wed, 19 Jul 2000 14:10:20
-----Original Message-----
From: Richard Poole [mailto:rpoole17@l...]
Sent: 18 July 2000 23:09
To: support@w...
Subject: 

Dear Wrox

I have been reading your book, Instant Javascript, unfortunatly, while 
trying to create a shopping cart, and when trying to view the items int he 
cart, i get the following error
Object doesn't support this action.  On line 22, character 1
<HTML>
<BODY>
I currently have ordered:<BR><SCRIPT>
var i;
var linetotal = 0, subtotal = 0;

for ( i in top.cart)
{
document.write(' Item: '+top.cart[i].name);
document.write(', '+top.cart[i].quantity+' at '+top.cart[i].price);
linetotal = top.cart[i].quantity * top.cart[i].price;
document.write(' each makes: '+linetotal +'<BR>');
subtotal += linetotal;
}
document.write('<BR>Total due is: '+subtotal+'<BR>');
</SCRIPT>
<FORM METHOD="Post">
<SCRIPT>
var Item;
for (i in top.cart)
{
item = '<INPUT TYPE="hidden" NAME="'+i+'" 
VALUE="'+top.cart[i].quantity+'">';   //LINE 22
document.write(item);
}
</SCRIPT>
<BR>
Credit Card Details
<INPUT TYPE="text" NAME="card_number">
<INPUT TYPE="submit" VALUE="BUY IT">
</FORM>
</BODY>
</HTML>

The page has been created for test purposes for now, but am planning on 
implimenting it in an upcomming site.  Please can you tell me why this is 
happening.
I also get another problem in a different area.  While trying to redirect a 
page, where the browser is Netscape, the page will not redirect, I have 
copied exactly what I found in the Instant HTML book on page  278, however 
I am able to redirect with IE, but not with Netscape 4.72.  I have tried 
using the document.write('<META NAME="Refresh" 
CONTENT=0;URL=netscape.html">  However neither location.href, nor 
document.write work.
If you could contact me regarding these, I would be extremly grateful.  I 
must also give great thanks to wrox press. I currently own, Instant HTML, 
Instant Javascript, and VBscript Programmers Reference I bought today.  All 
of which I have found to be very useful, and very detailed, which have 
helped me immensly, and I will continue to buy your books, as I find them 
to be the most useful of them all.

Many Thanks

Richard Poole

  Return to Index