// Java Scripts VPScripts.php VentasalPublico Mayo 2007 // Funciones para Agregar Items al Carro de Compras una usando Java Scripts y otra Usando AJAX // Agregar al Carro de Compras Java Scripts function AlCarro(sId,Id,MMen,LlamaPos) { var NId,Cant; if(Id == "0") { Cant = 0; NId = "&VPSC_Cantidad=0"; } else { Cant = document.getElementById(Id).value; NId = "&VPSC_Cantidad=" +Cant; if(Cant > 0) { Mens = "Se Agrego al carro de compras: "; } else { Mens = "Se Retiro del carro de compras: "; } if(MMen > 0) { alert(Mens +Cant +" Articulos"); } } window.location.replace(LlamaPos + sId +NId); } // Agregar al Carro de Compras AJAX function AlCarroAJ(sId,Id,MMen) { var NId,Cant; document.getElementById("ShopCartImg").innerHTML = VP_ImagenCarga; if(Id == "0") { Cant = 0; NId = "&VPSC_Cantidad=0"; } else { Cant = document.getElementById(Id).value; NId = "&VPSC_Cantidad=" +Cant; if(Cant > 0) { Mens = "Se Agrego al carro de compras: "; } else { Mens = "Se Retiro del carro de compras: "; } if(MMen > 0) { alert(Mens +Cant +" Articulos"); } } http.open("GET", url + sId +NId, true); http.onreadystatechange = ShopCartResponse; http.send(null); } function ShopCartResponse() { if (http.readyState == 4) { if(http.status == 200) { var results=http.responseText; document.getElementById("ShopCart").innerHTML = results; document.getElementById("ShopCartImg").innerHTML = VP_EnlaceShopCar; } } } function getHTTPObject() { var xmlhttp; if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); } else if (window.ActiveXObject){ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); if (!xmlhttp){ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlhttp; } var http = getHTTPObject(); // We create the HTTP Object // Fin Carro de Compras AJAX