
09/12/2002, 16:30
|
| | Fecha de Ingreso: noviembre-2002
Mensajes: 25
Antigüedad: 22 años, 5 meses Puntos: 0 | |
lo siento, no me sale, soy medio tonto o no se...
he llegado hasta aquí y no se cómo aplicar el: function Total() {
document.writeln(alterError(totprice));
document.pasarela.importe.value=(alterError(totpri ce));
}
que me dices. <html>
<head>
<title>Formulario</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
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();
}
</SCRIPT>
<SCRIPT language="javascript">
function identificador(){
mes = new Array ("01","02","03","04","05","06","07","08","09","10" ,"11","12");
hoy = new Date();
index = hoy.getMonth();any = hoy.getYear();dia = hoy.getDate();hora = hoy.getHours();
minutos = hoy.getMinutes();segundos = hoy.getSeconds();
any=any+"";
any=any.substring(2,4);
if (dia < 10) { dia = "0" + dia; }
if (hora < 10) { hora = "0" + hora; }
if (minutos < 10) { minutos = "0" + minutos; }
if (segundos < 10) { segundos = "0" + segundos; }
document.pasarela.idpedido.value = (any + mes[index]+ dia + hora + minutos + segundos); document.pasarela.importe.value = 1000 ;}
}
<SCRIPT>
<BODY onload=identificador()>
<center>
<table border="0" cellpadding="0" cellspacing="0" width="640" class="body">
<tr>
<td width="50%"><big><big>Formulario</big></big></td>
<td width="50%" align="right">[ <a href="carrito.htm">Carrito de Compra</a> | <a href="estado.htm">Estado</a> | Formulario ]</td>
</tr>
<tr>
<td width="100%" colspan="2">
<hr size="1" color="#000000">
</td>
</tr>
<tr>
<td width="100%" colspan="2"></td>
</tr>
</table>
<FORM method="get" action="https://www.lacaixa.es/cgi-bin/totpvcaixa?" name="pasarela">
<script language="JavaScript">
function Total() {
document.writeln(alterError(totprice));
document.pasarela.importe.value=importe;
}
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));
}
</script>
<input type="hidden" name="idcom" value="96322X">
<input type="hidden" name="idpedido" value="+idpedido+">
<input type="hidden" name="moneda" value="XEU">
<input type="hidden" name="idioma" value="esp">
<input type="text" name="importe" value="+importe+">
<input type="hidden" name="titulo" value="Senyor">
<table cols="2" width="370" class="body">
<td width="130"></td>
<td width="270">
</td>
</tr>
<tr><td>Nombre</td><td><input type="text" name="nombre" size=34></td></tr>
<tr><td>Apellido</td><td><input type="text" name="apellido1" size=34></td></tr>
<tr><td>Domicilio</td><td><input type="text" name="domicilio" size=34></td></tr>
<tr><td>Ciudad</td><td><input type="text" name="ciudad" size=34></td></tr>
<tr><td>Provincia</td><td><input type="text" name="provincia" size=34></td></tr>
<tr><td>Código Postal</td><td><input type="text" name="cp" size=34></td></tr>
<tr><td>País</td><td><input type="text" name="pais" size=34></td></tr>
<tr><td>E-mail</td><td><input type="text" name="email" size=34></td></tr>
<tr><td>Teléfono</td><td><input type="text" name="telefono" size=34></td></tr>
<tr><td>Fax</td><td><input type="text" name="fax" size=34></td></tr>
<SCRIPT LANGUAGE="JavaScript">
showItems();
</SCRIPT>
<tr>
<td>Total:</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>
</form>
</center>
</body>
</html>
lo siento, ¿como y donde meto la función que me dices?
__________________ j. A |