im using this code for this page http://ariosvml.wix.com/depositos#!colombia/c24vq
Its working, but how can i enable a quantity for some items and remove the global quantity?
This is the code
Regards,Code:<!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!-- Paste this code into an external JavaScript file (remove the opening and closing <script> tags) --> <script type="text/javascript"> /* This script and many more are available free online at The JavaScript Source :: http://javascript.internet.com Created by: Kevin Hartig :: http://www.grafikfx.net/ */ // Calculate the total for items in the form which are selected. function calculateTotal(inputItem) { var calculatedTotal = multiplier = i = 0, form = inputItem.form, els = form.elements, tot; for(i; i < els.length; ++i){ if (els[i].type === "checkbox" && els[i].checked) { calculatedTotal += +els[i].value; ++multiplier; } else if (els[i].type === "radio" && els[i].checked) { calculatedTotal += els[i].value * (multiplier || 1); } } calculatedTotal *= form.quantity.value; // Total value should never be less than 0. if (calculatedTotal < 0) { InitForm(); return; } // Set total field(s) to total value. tot = formatCurrency(calculatedTotal); for (i = form.total.length - 1; i > -1; --i){ form.total[i].value = tot; } } // Format a value as currency. function formatCurrency(num) { num = num.toString(10).replace(/[$,]/g,''); if(isNaN(num)){num = 0;} return ((num == (num = Math.abs(num))?'':'-') + '$' + num.toFixed(0)); } // This function initialzes all the form elements to default values. function InitForm(form) { // Reset values on form. var tots = form.total, els = form.elements; for (var i = tots.length - 1; i > -1; --i){ tots[i].value = '$0'; } // Set all checkboxes and radio buttons on form to unchecked. for (i = els.length - 1; i > -1; --i){ if (els[i].checked) { els[i].checked = false; } else if (els[i].tagName.toLowerCase() === 'select'){ els[i].options.selectedIndex = 0; } } } </script> <!-- Paste this code into the HEAD section of your HTML document Change the file name and path to match the one you created <script type="text/javascript" src="yourFileName.js"></script> --> <style type="text/css"> form { font: normal 90% verdana, helvetica, arial, sans-serif; } fieldset, legend { border: 2px solid #aaa; border-radius: 7px; } legend { padding: 3px 5px; font-weight: bold; font-size: 90%; } form b { font-size: 110%; } </style> </head> <body> <!-- Paste this code into the BODY section of your HTML document --> <div style="width: 430px; margin: auto;"> <form method="post" name="selectionForm"> <b>MyCraft Colombia</b><br><br> <fieldset><legend>Rangos Generales</legend><br> <label><input type="checkbox" name="vip" value="10000"> VIP 1 mes $10000</label> <br> <label><input type="checkbox" name="vip+" value="17500"> VIP+ 1 mes $17500</label> <br> <label><input type="checkbox" name="platinum" value="27500"> Platinum 1 mes $27500</label> <br> <label><input type="checkbox" name="elite" value="37500"> Elite 1 mes $37500</label> <br> <label><input type="checkbox" name="paqueteelite" value="40000"> Paquete Platinum 40 dias $40000</label> <br> <label><input type="checkbox" name="paqueteplatinum" value="52500"> Paquete Elite 40 dias $52500</label> <br> <label><input type="checkbox" name="vip3" value="28000"> VIP 3 meses $28000</label> <br> <label><input type="checkbox" name="vip+3" value="45500"> VIP+ 3 meses $45500</label> <br> <label><input type="checkbox" name="platinum3" value="68700"> Platinum 3 meses $68700</label> <br> <label><input type="checkbox" name="elite3" value="89900"> Elite 3 meses $89900</label> <br><br> <strong>Total:</strong> <input type="text" name="total" readonly> </fieldset> <br><br> <fieldset><legend>Survival 1.7:</legend><br> <legend>Armas RPG:</legend><br> <label><input type="checkbox" name="packrpgsurvival1.7" value="15000"> Pack de Armas $15000</label> <br> <label><input type="checkbox" name="venganzaquetzalcoatl1.7" value="8700"> Venganza de Quetzalcoatl + 15 Gemas $8700</label> <br> <label><input type="checkbox" name="ozmictlan1.7" value="10000"> Oz de Mictlan + 40 Gemas $10000</label> <br> <label><input type="checkbox" name="packhachas1.7" value="12500"> Pack de Hachas + 20 Gemas $12500</label> <br> <label><input type="checkbox" name="palogolpeador1.7" value="10000"> Palo Golpeador de Parejas Felices $10000</label> <br><br> <strong>Total:</strong> <input type="text" name="total" readonly> </fieldset> <br><br> <fieldset><legend>Cantidad</legend> <select name="quantity"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> </fieldset> <br><br> <strong>Pasos para Depositar:</strong><br><br> <span style="font: normal 16px arial, helvetica, sans-serif;"> 1. Dirigete al efecty mas cercano<br><br> 2. Menciona al cajero que haras un deposito de:<br><br> <div style="text-align: center;"> <strong>Monto:</strong> <input type="text" name="total" readonly> pesos <input type="reset"><br><br> al numero de cedula <strong>94541381</strong> a nombre de<br> <strong>Alexy Jair Cruz Peņa</strong> </div><br><br> 3. Manda un correo a depositos.mycraft@hotmail.com con los siguientes datos:<br><br> - Nick<br> - Fecha de Deposito<br> - Items Comprados<br> - Monto de depositado<br> - Foto del recibo o ticket (No Obligatorio)<br><br> <div style="text-align: center;"><strong>Si mandas foto del ticket tu pago se procesara mas rapido</strong></div><br><br> 4. Tu pago se procesara de 12 a 24 hrs<br><br> <div style="text-align: center;"><strong>Atencion: Si no tienes correo tambien puedes mandar estos datos a nuestro whatsapp +5215527699969</strong></div><br><br> </span> </form> </div> <p><div style="text-align: center;"> <span style="font: normal 10px arial, helvetica, sans-serif;">Free JavaScripts provided<br> by <a href="http://javascriptsource.com">The JavaScript Source</a></span> </div><p> <script type="text/javascript"> (function(){ var form = document.forms.selectionForm, puts = form.elements; InitForm(form); form.onreset = function(){InitForm(this); return false;}; for (var i = puts.length - 1; i > -1; --i){ if(/radio|checkbox/.test(puts[i].type)){ puts[i].onclick = function(){calculateTotal(this);}; } else if (puts[i].name === 'quantity') { puts[i].onchange = function(){calculateTotal(this);}; } else if (puts[i].name === 'total') { puts[i].onfocus = function(){this.blur();}; } } })(); </script> </body> </html>



Reply With Quote
Bookmarks