ciao a tutti
ho un problemino.....
ho creato un carrello della spesa con javascript seguendo le indicazioni di un manuale
soltanto che non so creare il form che prende i dati dal carrello e li manda via mail
questo è il codice;
<script language="javascript">
<!-- Hide fromnold browsers
var numItems = 0
var ShoppingCart = new Object
function addItem(Description, Price, ItemNum) {
this.Description = Description
this.Price = Price
this.ItemNum = ItemNum
this.display = printItem
return this
}
function addtoCart(Description, Price) {
ShoppingCart[numItems] = new addItem(Description, Price, numItems)
numItems = numItems + 1
alert (Description + "è stato aggiunto al carrello.")
}
function deleteItem(ItemNum) {
delete ShoppingCart[ItemNum]
viewCart()
}
function printItem(deleteFlag, TargetDocument) {
with (TargetDocument) {
write("<TR><TD>" + this.Description + "</TD>")
write("<TD ALIGN=RIGHT>$" + this.Price + "</TD>")
if (deleteFlag == true)
write("<TD>Togli dal Carrello</TD>")
write("</TR>")
}
}
function viewCart() {
var cartTotal = 0
with (top.MAIN.document) {
write()
close()
write("<HTML><TITLE>Carrello della spesa </TITLE>")
write("<BODY BGCOLOR=#A0D0E0><CENTER>")
write("<TABLE BORDER=0><TR>")
write("<TD><IMAGE SRC=cop.jpg></TD>")
write("<TD ALIGN=CENTER VALIGN=BOTTOM")
write("<H2>Carrello della spesa </H2></TD>")
write("<TD><IMGE SRC=comp3.jpg></TD></TR>")
write("</TABLE>")
write("
<HR>
")
write("<TABLE BORDER=1 CELLPADDING=3 CELLSPACING=1 WIDTH=500 BGCOLOR=LIGHTYELLOW>")
for (i in ShoppingCart) {
cartTotal = cartTotal + ShoppingCart[i].Price
if (ShoppingCart[i].ItemNum !=null)
ShoppingCart [i].display(true, top.MAIN.document)
}
write("<TR><TD>Totale:</TD><TD ALIGN=RIGHT>$" + cartTotal + "</TD>")
write("<TD></TD></TR></TABLE>
")
write("
</CENTER></BODY></HTML>")
}
}
//-->
</script>
grazie!!!!!