/ Forside / Teknologi / Udvikling / Java Scripts / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
Java Scripts
#NavnPoint
molokyle 5410
Klaudi 2799
smorch 2439
kim 1360
Harlekin 1134
bentjuul 984
gibson 800
severino 695
Random 675
10  konsulent.. 626
Værdier fra et script
Fra : Jesper


Dato : 17-03-02 16:30

Hej

Jeg har dette script:

<SCRIPT language=JavaScript>

// alterError - fixes a rounding bug in Netscape 2
function alterError(value) {
if (value<=0.99) {
newPounds = '0';
} else {
newPounds = parseInt(value);
}
newPence = parseInt((value+.0008 - newPounds)* 100);
if (eval(newPence) <= 9) newPence='0'+newPence;
newString = newPounds + '.' + newPence;
return (newString);
}

// showItems () - creates a table of items in the basket and
// creates the start of a form which sets information for
// basket items.
function showItems() {
index = document.cookie.indexOf("TheBasket");
countbegin = (document.cookie.indexOf("=", index) + 1);
countend = document.cookie.indexOf(";", index);
if (countend == -1) {
countend = document.cookie.length;
}
fulllist = document.cookie.substring(countbegin, countend);
totprice = 0;
document.writeln('<FORM NAME="BUY" action="mail.php" METHOD=POST>');
document.writeln('<input type="hidden" name="recipient"
value="jesper@vels.dk">');

document.writeln('<input type="hidden" name="subject" value="online
bestilling">');
document.writeln('<input type="hidden" name="redirect"
value="http://www.emb.dk/tak.htm">');

document.writeln('<TABLE width="460" BORDER=0 CELLPADDING=1 CELLSPACING=1
background="filer/bagg2.gif">');

document.writeln('<TR><TD width="240"><b><font size="2" FACE="Verdana"
COLOR="#ffffff"">Artikel</font></b></TD><TD width="70"><b><font size="2"
FACE="Verdana" COLOR="#ffffff"">&nbsp;Antal</font></b></TD><TD
width="70"><b><font size="2" FACE="Verdana"
COLOR="#ffffff"">&nbsp;&nbsp;kr/stk</font></b></TD><td width="70"
align="right"><b><font size="2" FACE="Verdana" COLOR="#ffffff"">kr
total</font></b></td></TR>');
itemlist = 0;
for (var i = 0; i <= fulllist.length; i++) {
if (fulllist.substring(i,i+1) == '[') {
thisitem = 1;
itemstart = i+1;
} else if (fulllist.substring(i,i+1) == ']') {
itemend = i;
thequantity = fulllist.substring(itemstart, itemend);
itemtotal = 0;
itemtotal = (eval(theprice*thequantity));
temptotal = itemtotal * 100;
totprice = totprice + itemtotal;
itemlist=itemlist+1;
document.write('<tr><td><FONT SIZE="2"
FACE="verdana">'+theitem+'</td>');
document.writeln('<td align=left><FONT SIZE="2"
FACE="verdana">&nbsp;&nbsp;'+thequantity+'</td><td align=left><FONT SIZE="2"
FACE="verdana">'+theprice+'</td><td align=right><FONT SIZE="2"
FACE="verdana">&nbsp;&nbsp;&nbsp;'+alterError(itemtotal)+'</td></tr>');
document.writeln('<INPUT TYPE="hidden" NAME="Artikel" NAME="Artikel
'+itemlist+'" VALUE="'+theitem+'" SIZE="40">');
document.writeln('<INPUT TYPE="hidden" NAME="Antal" NAME="Antal
'+itemlist+'" VALUE="'+thequantity+'" SIZE="40">');
document.writeln('<INPUT TYPE="hidden" NAME="Pris/stk" NAME="Pris/stk
'+itemlist+'" VALUE="'+theprice+'" SIZE="40">');
document.writeln('<INPUT TYPE="hidden" NAME="Total"
NAME="Total'+itemlist+'" VALUE="'+alterError(itemtotal)+'" SIZE="40">');
document.writeln('<INPUT TYPE="hidden" NAME="fuck"
NAME="fuck'+itemlist+'" VALUE="'+alterError(theitem)+'" SIZE="40">');
} else if (fulllist.substring(i,i+1) == '|') {
if (thisitem==1) theitem = fulllist.substring(itemstart, i);
if (thisitem==2) theprice = fulllist.substring(itemstart, i);
thisitem++;
itemstart=i+1;
}
}

document.writeln('<tr><td background="filer/bagg3.gif" colspan=3><b><FONT
SIZE="2" FACE="verdana" COLOR="Black">Kr. total excl.
fragt*.</FONT></b></td><td align=right background="filer/bagg3.gif"><FONT
SIZE="2" FACE="verdana"
COLOR="Black"><b>'+alterError(totprice)+'</b></td></tr>');
document.writeln('<INPUT TYPE="hidden" NAME="Varer Total"
VALUE="'+alterError(totprice)+'" SIZE="40">');
document.writeln('</TABLE>');

}


</SCRIPT>

Det skal jeg have til arbejde sammen med en php mail form...
Scriptet er en vare kurv til en webshop...
Det virker sådan set godt nok, bortset fra det er kun den første varer jeg
får med over på mail formen Hvordan får jeg alle varerne med?

min mail form er sådan ud:
<?PHP
$besked = "$Artikel,$Antal,$Pris/stk,$fuck";
mail(enemail@email.dk, "My Subject", "$besked");
?>



 
 
Søg
Reklame
Statistik
Spørgsmål : 177501
Tips : 31968
Nyheder : 719565
Indlæg : 6408527
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste