Results 1 to 1 of 1

Thread: enable a quantity for some items and remove the global quantity

  1. #1
    Join Date
    Mar 2016
    Thanked 0 Times in 0 Posts

    Default enable a quantity for some items and remove the global quantity

    im using this code for this page!colombia/c24vq

    Its working, but how can i enable a quantity for some items and remove the global quantity?

    This is the code

    <!DOCTYPE html>
    <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 ::
    Created by: Kevin Hartig :: */
    // 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;
    		} 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) {
    	// Set total field(s) to total value.
    	tot = formatCurrency(calculatedTotal);
    	for (i = - 1; i > -1; --i){[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 =, 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;
    <!-- 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%;
    <!-- 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>
        &nbsp;&nbsp;<label><input type="checkbox" name="vip" value="10000"> VIP 1 mes $10000</label>
        &nbsp;&nbsp;<label><input type="checkbox" name="vip+" value="17500"> VIP+ 1 mes $17500</label>
        &nbsp;&nbsp;<label><input type="checkbox" name="platinum" value="27500"> Platinum 1 mes $27500</label>
        &nbsp;&nbsp;<label><input type="checkbox" name="elite" value="37500"> Elite 1 mes $37500</label>
        &nbsp;&nbsp;<label><input type="checkbox" name="paqueteelite" value="40000"> Paquete Platinum 40 dias $40000</label>
        &nbsp;&nbsp;<label><input type="checkbox" name="paqueteplatinum" value="52500"> Paquete Elite 40 dias $52500</label>
        &nbsp;&nbsp;<label><input type="checkbox" name="vip3" value="28000"> VIP 3 meses $28000</label>
        &nbsp;&nbsp;<label><input type="checkbox" name="vip+3" value="45500"> VIP+ 3 meses $45500</label>
        &nbsp;&nbsp;<label><input type="checkbox" name="platinum3" value="68700"> Platinum 3 meses $68700</label>
        &nbsp;&nbsp;<label><input type="checkbox" name="elite3" value="89900"> Elite 3 meses $89900</label>
        <input type="text" name="total" readonly>
    <fieldset><legend>Survival 1.7:</legend><br>
        <legend>Armas RPG:</legend><br>
        &nbsp;&nbsp;<label><input type="checkbox" name="packrpgsurvival1.7" value="15000"> Pack de Armas $15000</label>
        &nbsp;&nbsp;<label><input type="checkbox" name="venganzaquetzalcoatl1.7" value="8700"> Venganza de Quetzalcoatl + 15 Gemas $8700</label>
        &nbsp;&nbsp;<label><input type="checkbox" name="ozmictlan1.7" value="10000"> Oz de Mictlan + 40 Gemas $10000</label>
        &nbsp;&nbsp;<label><input type="checkbox" name="packhachas1.7" value="12500"> Pack de Hachas + 20 Gemas $12500</label>
        &nbsp;&nbsp;<label><input type="checkbox" name="palogolpeador1.7" value="10000"> Palo Golpeador de Parejas Felices $10000</label>
        <input type="text" name="total" readonly>
      <select name="quantity">
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
        <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;">
        <input type="text" name="total" readonly>&nbsp;pesos&nbsp;
        <input type="reset"><br><br>
        al numero de cedula <strong>94541381</strong> a nombre de<br>
        <strong>Alexy Jair Cruz Peņa</strong>
        3. Manda un correo a con los siguientes datos:<br><br>
        &nbsp;&nbsp;&nbsp;&nbsp; - Nick<br>
        &nbsp;&nbsp;&nbsp;&nbsp; - Fecha de Deposito<br>
        &nbsp;&nbsp;&nbsp;&nbsp; - Items Comprados<br>
        &nbsp;&nbsp;&nbsp;&nbsp; - Monto de depositado<br>
        &nbsp;&nbsp;&nbsp;&nbsp; - 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>
    <p><div style="text-align: center;">
    <span style="font: normal 10px arial, helvetica, sans-serif;">Free JavaScripts provided<br>
    by <a href="">The JavaScript Source</a></span>
    <script type="text/javascript">
    	var form = document.forms.selectionForm, puts = form.elements;
    	form.onreset = function(){InitForm(this); return false;};
    	for (var i = puts.length - 1; i > -1; --i){
    			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();};
    Last edited by jscheuer1; 04-28-2016 at 03:54 PM. Reason: format link

Similar Threads

  1. Replies: 5
    Last Post: 11-15-2011, 09:30 PM
  2. JavaScript display quantity help
    By desmond_ckl in forum JavaScript
    Replies: 0
    Last Post: 10-20-2011, 07:21 AM
  3. Get price via quantity field
    By gwmbox in forum JavaScript
    Replies: 1
    Last Post: 01-07-2011, 11:16 AM
  4. Decrease quantity as used
    By cindybrock61 in forum Other
    Replies: 2
    Last Post: 10-30-2009, 09:46 AM
  5. Replies: 2
    Last Post: 07-16-2008, 10:57 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts