codigo html:
Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>..::Refill4less::..</title> <style type="text/css"> <!-- body { background-image: url(); background-repeat: repeat; background-color: #BBE1EE; } a:link { text-decoration: none; } a:visited { text-decoration: none; } a:hover { text-decoration: underline; } a:active { text-decoration: none; } #Layer1 { position:absolute; left:76px; top:20px; width:4px; height:87px; z-index:1; } .style1 { font-family: Arial; color: #999999; } --> </style><SCRIPT LANGUAGE="JavaScript" src="http://www.level1websites.com/LEVEL1/usa/refill4less/tienda5.js"></script> </head> <body><SCRIPT LANGUAGE="JavaScript" src="http://www.level1websites.com/LEVEL1/usa/refill4less/tienda6.js"></script> <div align="center"> <table width="84%" height="606" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td colspan="4"> </td> <td> </td> <td> </td> </tr> <tr> <td colspan="4"><div align="center"><img src="home/logorefill.gif" width="500" height="100" alt="logo" /></div></td> <td width="29%"> </td> <td> </td> </tr> <tr> <td colspan="4"> </td> <td> </td> <td> </td> </tr> <tr> <td colspan="4"> </td> <td> </td> <td> </td> </tr> <tr> <td colspan="4"> </td> <td><img src="home/menu.gif" alt="" width="230" height="32" border="0" align="left" usemap="#Map" /></td> <td width="1%"> </td> </tr> <tr> <td height="151" colspan="6"><table width="800" height="150" border="1" align="center" cellpadding="0" cellspacing="0"> <tr> <td><img src="home/cabecerabus.gif" width="800" height="150" /></td> </tr> </table></td> </tr> <tr> <td colspan="3"><a href="estado.htm">Estado</a></td> <td><a href="formulario.htm">Formulario</a></td> <td> </td> <td> </td> </tr> <tr> <td width="7%"> </td> <td width="7%"> </td> <td width="7%"> </td> <td colspan="3"> </td> </tr> <tr> <td colspan="5" rowspan="12"><div align="center"> <table width="91%" height="237" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="192" background=""> <form method="post" action="formulario.php" target="_self"> <div align="center"> <input type="hidden" name="recipient" value="[email protected]"> <input type=hidden name="subject" value="Pedido- Orden de Compra"> <input type="hidden" name="ok_url" value="formulario.htm"> <input type=hidden name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT"> <table cols="2" width="370" class="body"> <td width="130"></td> <td width="270"> </td> </tr> <tr> <td><font face="Arial" color="#004080">Nombre:</font></td> <td><input type="text" name="nombre" size=34></td></tr> <tr> <td><font face="Arial" color="#004080">Apellidos:</font></td> <td><input type="text" name="apellidos" size=34></td></tr> <tr> <td><font face="Arial" color="#004080">Domicilio:</font></td> <td><input type="text" name="domicilio" size=34></td></tr> <tr> <td><font face="Arial" color="#004080">Ciudad:</font></td> <td><input type="text" name="ciudad" size=34></td></tr> <tr> <td><font face="Arial" color="#004080">Provincia:</font></td> <td><input type="text" name="provincia" size=34></td></tr> <tr> <td><font face="Arial" color="#004080">Código Postal:</font></td> <td> <input type="text" name="cp" size=15> </td></tr> <tr> <td><font face="Arial" color="#004080">País:</font></td> <td><input type="text" name="pais" size=34></td></tr> <tr> <td><font face="Arial" color="#004080">E-mail:</font></td> <td> <input type="text" name="email" size=34> </td></tr> <tr> <td><font face="Arial" color="#004080">Teléfono:</font></td> <td> <input type="text" name="telefono" size=15> </td></tr> <tr> <td><font face="Arial" color="#004080">D.N.I.:</font></td> <td> <input type="text" name="DNI" size=15> </td></tr> <SCRIPT LANGUAGE="JavaScript"> showItems(); </SCRIPT> <tr> <td><font face="Arial" color="#004080">Total:</font></td> <td>$ <SCRIPT LANGUAGE="JavaScript">Total()</SCRIPT> </td> </tr> <tr> <td><br><br></td> <td> <input type="BUTTON" value="Enviar" onClick="return Enviar(this.form)"> <input type="reset" value="Restablecer"> </td> </tr> </table> </div> </form> </td> </tr> <tr> <td background=""><div align="right"></div></td> </tr> <tr> <td height="26" bgcolor="#F5F5F5"><div align="left"> <table width="98%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="6%"> </td> <td width="61%"> </td> <td width="33%"><div align="right"><span class="style1">Copyright © 2007 </span></div></td> </tr> </table> </div></td> </tr> </table> </html>
las librerias java que utilizan son las siguientes:
tienda5.js
<!--
function Enviar(form) {
for (i = 0; i < form.elements.length; i++) {
if (form.elements[i].type == "text" && form.elements[i].value == "") {
alert("Por favor complete todos los campos del formulario"); form.elements[i].focus();
return false; }
}
form.submit();
}
// -->
tienda6.js
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);
}
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;
itemlist = 0;
for (var i = 0; i <= fulllist.length; i++) {
if (fulllist.substring(i,i+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;
var tax = itemtotal / 100 * (0 - 0);
tax = Math.floor(tax * 100)/100
totprice = totprice + itemtotal + tax;
itemlist=itemlist+1;
document.writeln('<INPUT TYPE="hidden" NAME="Producto'+itemlist+'" VALUE="'+theitem+'" SIZE="40">');
document.writeln('<INPUT TYPE="hidden" NAME="Cantidad'+itemlist+'" VALUE="'+thequantity+'" SIZE="40">')
document.writeln('<INPUT TYPE="hidden" NAME="ProductoTotal'+itemlist+'" VALUE="'+alterError(itemtotal)+'" SIZE="40">');
} else if (fulllist.substring(i,i+1) == ',') {
theitem = fulllist.substring(itemstart, i);
itemstart = i+1;
} else if (fulllist.substring(i,i+1) == '#') {
theprice = fulllist.substring(itemstart, i);
itemstart = i+1;
}
}
document.writeln('<INPUT TYPE="hidden" NAME="Total" VALUE="'+alterError(totprice)+'" SIZE="40">');
}
function Total() {
document.writeln(alterError(totprice));
}
gracias por la ayuda brindada