Foros del Web » Programando para Internet » Javascript »

Pasar resultados de JavaScript a codigo ASP

Estas en el tema de Pasar resultados de JavaScript a codigo ASP en el foro de Javascript en Foros del Web. Hola Amigos...alguien me puede ayudar... tengo un carro de compra que esta en JavaScript...y quiero ver si los resultados que me entraga al ir poblanado ...
  #1 (permalink)  
Antiguo 06/08/2004, 14:13
 
Fecha de Ingreso: marzo-2004
Mensajes: 37
Antigüedad: 20 años, 1 mes
Puntos: 0
Pasar resultados de JavaScript a codigo ASP

Hola Amigos...alguien me puede ayudar...
tengo un carro de compra que esta en JavaScript...y quiero ver si los resultados que me entraga al ir poblanado el carro de compras los puedo transformar al final del proceso y recogerlos en variables ASP.
para asi poder guardarlos en mi base de datos ya que con JS no puedo.

este es mi codigo JS...
<SCRIPT LANGUAGE="JavaScript">

function alterError(value) {
if (value<=0.99) {
newPounds = '0';
} else {
newPounds = parseInt(value);
}
newPence = parseInt((value+.0008 - newPounds)* 100);
if (eval(newPence) <= 9)
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;
document.writeln('<form><table border="1" cellspacing="0" width="640" bgcolor="#E0E0E0" bordercolor="#FFFFFF" class="td">');

document.writeln('<TR><TD width="250"><b>Producto</b></TD><TD width="80" align="right"><b>Cantidad</b></TD><TD width="120" align="right"><b>Costo x unidad</b></TD><td width="100" align="right"><b>Costo total</b><TD width="90">&nbsp;</TD></TR>');
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('<tr><td>'+theitem+'</td><td align=right>'+thequantity+'</td><td align=right>'+theprice+'</td><td align=right>'+alterError(itemtotal)+'</td><td align=center><input TYPE="button" NAME="remove" VALUE="Quitar" onclick="javascript:removeItem('+itemlist+')"></td></tr>');
} 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('<tr><td colspan=3><b>Total</b></td><td align=right>'+alterError(totprice)+'</td><td>&nbsp;</td></tr>');
document.writeln('</TABLE>');
}

function removeItem(itemno) {
newItemList = null;
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;
theitem = fulllist.substring(itemstart, itemend);
itemlist=itemlist+1;
if (itemlist != itemno) {
newItemList = newItemList+'['+fulllist.substring(itemstart, itemend)+']';
}
}
}
index = document.cookie.indexOf("TheBasket");
document.cookie="TheBasket="+newItemList;
top.location = "estado.asp";
}

function clearBasket() {
if (confirm('¿Confirma que desea reestablecer el carrito?')) {
index = document.cookie.indexOf("TheBasket");
document.cookie="TheBasket=.";
top.location = "estado.asp";
}
}
</SCRIPT>


Como podria modificar este codigo para pasar los valores a otra pagina y tomarlos como variables en ASP ??

ojala alguien me pueda hechar una mano.
gracias
Alfredo
  #2 (permalink)  
Antiguo 06/08/2004, 14:32
Avatar de tunait
Moderadora
 
Fecha de Ingreso: agosto-2001
Ubicación: Terok Nor
Mensajes: 16.805
Antigüedad: 22 años, 8 meses
Puntos: 381
Te quedan todos los valores almacenados en las cookies?
  #3 (permalink)  
Antiguo 06/08/2004, 20:24
 
Fecha de Ingreso: abril-2004
Ubicación: México D.F.
Mensajes: 1.724
Antigüedad: 20 años
Puntos: 4
A traves de un formulario o la cadena de consulta.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:03.