Foros del Web » Creando para Internet » Diseño web »

Formulario ligado a carrito

Estas en el tema de Formulario ligado a carrito en el foro de Diseño web en Foros del Web. hola tengo un problema, un amigo me paso este codigo de la parte del formulario de un carrito de compras. la estructura es la siguiente ...
  #1 (permalink)  
Antiguo 21/11/2007, 14:08
ppx
 
Fecha de Ingreso: noviembre-2007
Mensajes: 4
Antigüedad: 16 años, 4 meses
Puntos: 0
Sonrisa Formulario ligado a carrito

hola tengo un problema, un amigo me paso este codigo de la parte del formulario de un carrito de compras. la estructura es la siguiente primero sale la lista de compras ahi eliges cuantos articulos compras, seguido pasas a una opcion de estado donde sale la lista de articulos que elegiste con el monto de la compra y por ultimo pasas a un formulario donde pones tus datos personales el cual es el que esta fallando. cuando pongo enviar no funciona. creo q falta esa funcion pero no se como hacerla por favor ayuda.
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">&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</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%">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td colspan="4">&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td colspan="4">&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td colspan="4">&nbsp;</td>
      <td><img src="home/menu.gif" alt="" width="230" height="32" border="0" align="left" usemap="#Map" /></td>
      <td width="1%">&nbsp;</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>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td width="7%">&nbsp;</td>
      <td width="7%">&nbsp;</td>
      <td width="7%">&nbsp;</td>
      <td colspan="3">&nbsp;</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%">&nbsp;</td>
                    <td width="61%">&nbsp;</td>
                    <td width="33%"><div align="right"><span class="style1">Copyright &copy; 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
  #2 (permalink)  
Antiguo 22/11/2007, 05:03
 
Fecha de Ingreso: noviembre-2007
Mensajes: 16
Antigüedad: 16 años, 4 meses
Puntos: 0
Re: Formulario ligado a carrito

<input type="BUTTON" value="Enviar" onClick="return Enviar(this.form)">
<input type="reset" value="Restablecer"> </td>


en vez de BUTTON prueba con SUBMIT.
  #3 (permalink)  
Antiguo 22/11/2007, 13:23
ppx
 
Fecha de Ingreso: noviembre-2007
Mensajes: 4
Antigüedad: 16 años, 4 meses
Puntos: 0
Pregunta Re: Formulario ligado a carrito

bueno ya arregle ese detalle.....ahora lo que me preocupa es lo siguiente cuando yo hago una compra mi listado no carga, antes de comenzar a comprar debo de limpiar el carrito (reestablecer) aunque este este sin ningun item, es decir la lista empieza a cargar dedsde la segunda vez........bueno esto pasa usando iexplorer, pero si uso el mozzila no hay ningun problema.
hay alguna forma que al abrir el index por primera vez se ejecute una funcion clear basquet sin q el usuario se de cuenta?
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 14:47.