SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Oct 2011
    Posts
    658
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem in Multiple onkey event

    Hi...


    I just want to know how can I compute the Total Maximum Dozen while I'm input number in the textboxes from Maximum Lot.


    Now, in my code:

    When I input in textbox from Maximum lot it computes the Maximum Dozen and Total Maximum Lot, and the Total Maximum Dozen was only compute or change when I press the key on the textbox from Maximum Dozen.

    I want to happen is:when I input in Maximum Lot textboxes the total Maximum Lot, Maximum Dozen, and Total Maximum Dozen will compute.

    Here is my code:

    PHP Code:
    <html>
    <head>
    <title>Half Shell</title>
    <link rel="stylesheet" type="text/css" href="kanban.css" />
     
    <script type="text/javascript">
    //auto compute Total  Max
    function autocalearn(oText)
    {
      var P28_max_lot = document.getElementById("P28_max_lot").value;
        var P28_bch_wt = document.getElementById("P28_bch_wt").value;
        var P28_plug_wt = document.getElementById("P28_plug_wt").value;
        var P28_max_convert = (parseFloat(P28_max_lot) * ((parseFloat(P28_bch_wt))* parseFloat(1000)) / parseFloat(P28_plug_wt) / parseFloat(12));     
        if( !isNaN(P28_max_convert) ){   
        var P28_max_doz = document.getElementById("P28_max_doz").value = P28_max_convert.toFixed(2);
        }
        
        var P30_max_lot = document.getElementById("P30_max_lot").value;
        var P30_bch_wt = document.getElementById("P30_bch_wt").value;
        var P30_plug_wt = document.getElementById("P30_plug_wt").value;
        var P30_max_convert = (parseFloat(P30_max_lot) * ((parseFloat(P30_bch_wt))* parseFloat(1000)) / parseFloat(P30_plug_wt) / parseFloat(12)); 
        if( !isNaN(P30_max_convert) ){   
        var P30_max_doz = document.getElementById("P30_max_doz").value = P30_max_convert.toFixed(2);
        }
        
        var P32_max_lot = document.getElementById("P32_max_lot").value;
        var P32_bch_wt = document.getElementById("P32_bch_wt").value;
        var P32_plug_wt = document.getElementById("P32_plug_wt").value;
        var P32_max_convert = (parseFloat(P32_max_lot) * ((parseFloat(P32_bch_wt))* parseFloat(1000)) / parseFloat(P32_plug_wt) / parseFloat(12)); 
        if( !isNaN(P32_max_convert) ){
        var P32_max_doz = document.getElementById("P32_max_doz").value = P32_max_convert.toFixed(2);
        }
            
        var P33_max_lot = document.getElementById("P33_max_lot").value;
        var P33_bch_wt = document.getElementById("P33_bch_wt").value;
        var P33_plug_wt = document.getElementById("P33_plug_wt").value;
        var P33_max_convert = (parseFloat(P33_max_lot) * ((parseFloat(P33_bch_wt))* parseFloat(1000)) / parseFloat(P33_plug_wt) / parseFloat(12));  
        if( !isNaN(P33_max_convert) ){
        var P33_max_doz = document.getElementById("P33_max_doz").value = P33_max_convert.toFixed(2);
        }
        
        var P35_max_lot = document.getElementById("P35_max_lot").value;
        var P35_bch_wt = document.getElementById("P35_bch_wt").value;
        var P35_plug_wt = document.getElementById("P35_plug_wt").value;
        var P35_max_convert = (parseFloat(P35_max_lot) * ((parseFloat(P35_bch_wt))* parseFloat(1000)) / parseFloat(P35_plug_wt) / parseFloat(12)); 
        
        if( !isNaN(P35_max_convert) ){
        var P35_max_doz = document.getElementById("P35_max_doz").value = P35_max_convert.toFixed(2);
        }
        
        var P35M_max_lot = document.getElementById("P35M_max_lot").value; 
        var P35M_bch_wt = document.getElementById("P35M_bch_wt").value;
        var P35M_plug_wt = document.getElementById("P35M_plug_wt").value;
        var P35M_max_convert = (parseFloat(P35M_max_lot) * ((parseFloat(P35M_bch_wt))* parseFloat(1000)) / parseFloat(P35M_plug_wt) / parseFloat(12)); 
        if( !isNaN(P35M_max_convert) ){
        var P35M_max_doz = document.getElementById("P35M_max_doz").value = P35M_max_convert.toFixed(2);
        }
        
        var P35W_max_lot = document.getElementById("P35W_max_lot").value;  
        var P35W_bch_wt = document.getElementById("P35W_bch_wt").value;
        var P35W_plug_wt = document.getElementById("P35W_plug_wt").value;
        var P35W_max_convert = (parseFloat(P35W_max_lot) * ((parseFloat(P35W_bch_wt))* parseFloat(1000)) / parseFloat(P35W_plug_wt) / parseFloat(12));
        if( !isNaN(P35W_max_convert) ){
        var P35W_max_doz = document.getElementById("P35W_max_doz").value = P35W_max_convert.toFixed(2);
        }
        
        var P38_max_lot = document.getElementById("P38_max_lot").value;
        var P38_bch_wt = document.getElementById("P38_bch_wt").value;
        var P38_plug_wt = document.getElementById("P38_plug_wt").value;
        var P38_max_convert = (parseFloat(P38_max_lot) * ((parseFloat(P38_bch_wt))* parseFloat(1000)) / parseFloat(P38_plug_wt) / parseFloat(12));
        if( !isNaN(P38_max_convert) ){
        var P38_max_doz = document.getElementById("P38_max_doz").value = P38_max_convert.toFixed(2);
        }
            
    if (isNaN(oText.value)) 
    {
    alert('Numbers only!');
    oText.value = '';
    }
    var field, val, oForm = oText.form, Total_max_lot = a = 0;
    for (a; a < arguments.length; ++a) //loop through text elements
    {
    field = arguments[a];
    val = parseFloat(field.value); 

    if (!isNaN(val)) //number?
    {
    Total_max_lot += val; 
    }
    }                                                                                 
    oForm.Total_max_lot.value = Total_max_lot.toFixed(2); 
     
    }     
     </script> 
    <script type="text/javascript">
    //Auto convert to Doz and auto compute total max doz
    function doz(oText){  
    if (isNaN(oText.value)) 
    {

    oText.value = '';

    var field, val, oForm = oText.form, Total_max_doz = a = 0;
    for (a; a < arguments.length; ++a) //loop through text elements
    {
    field = arguments[a];
    val = parseFloat(field.value);     

    if (!isNaN(val)) //number?
    {
    Total_max_doz += val; 
    }
    }
    oForm.Total_max_doz.value = Total_max_doz.toFixed(2);
    }
    </script>

    </head>
     <?php

      date_default_timezone_set
    ("Asia/Singapore");
    $con mysql_connect('localhost''root','');

    if (!
    $con) {
        echo 
    'failed';
        die();
    }

    mysql_select_db("mes"$con);

    ?>
    <body>
    <form name="loading_kanban" action="" method="post" onSubmit="return false">

    <div id="fieldset_PS">
    <table>
    <th>Compounds</th>
    <th>Max</th>
    <th>UoM</th>
    <th>Max</th>
    <th>UoM</th>

    <tr>
    <td><input type="text" name="P28" id="P28" value="P28" ></td>
    <td><input type="text" name="P28_max_lot" id="P28_max_lot"  value="<?php echo $P28_max_lot?>" onkeyup="return autocalearn(this, P30_max_lot, P32_max_lot, P33_max_lot, P35_max_lot, P35M_max_lot, P35W_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td>
    <td><input type="text" name="P28_max_lot_uom" id="P28_max_lot_uom" value="Lot" ></td>
    <td><b><input type="text" name="P28_max_doz" id="P28_max_doz"  value="<?php echo $P28_max_doz;?>" onkeyup="return doz(P28_max_doz, P30_max_doz, P32_max_doz, P33_max_doz, P35_max_doz, P35M_max_doz, P35W_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)" ></b></td>
    <td><input type="text" name="P28_max_doz_uom" id="P28_max_doz_uom" value="Doz" ></td> 
    </tr>
    <tr>
    <td><input type="text" name="P30" id="P30" value="P30" ></td>
    <td><input type="text" name="P30_max_lot" id="P30_max_lot"  value="<?php echo $P30_max_lot;?>" onkeyup="return autocalearn(this, P28_max_lot, P32_max_lot, P33_max_lot, P35_max_lot, P35M_max_lot, P35W_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td>
    <td><input type="text" name="P30_max_lot_uom" id="P30_max_lot_uom" value="Lot" ></td>
    <td><b><input type="text" name="P30_max_doz" id="P30_max_doz"  value="<?php echo $P30_max_doz?>" onkeyup="return doz(this, P28_max_doz, P32_max_doz, P33_max_doz, P35_max_doz, P35M_max_doz, P35W_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)"></b></td>
    <td><input type="text" name="P30_max_doz_uom" id="P30_max_doz_uom" value="Doz" ></td>
    </tr>    

    <tr> 
    <td><input type="text" name="P32" id="P32" value="P32" ></td>
    <td><input type="text" name="P32_max_lot" id="P32_max_lot"  value="<?php echo $P32_max_lot ;?>" onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P33_max_lot, P35_max_lot, P35M_max_lot, P35W_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td>
    <td><input type="text" name="P32_max_lot_uom" id="P32_max_lot_uom" value="Lot" ></td>
    <td><b><input type="text" name="P32_max_doz" id="P32_max_doz" value="<?php echo $P32_max_doz?>" onkeyup="return doz(this, P28_max_doz, P30_max_doz, P33_max_doz, P35_max_doz, P35M_max_doz, P35W_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)"></b></td>
    <td><input type="text" name="P32_max_doz_uom" id="P32_max_doz_uom" value="Doz" ></td>
    </tr>   
    <tr>
    <td><input type="text" name="P33" id="P33" value="P33" ></td>
    <td><input type="text" name="P33_max_lot" id="P33_max_lot"  value="<?php echo $P33_max_lot?>"  onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P32_max_lot, P35_max_lot, P35M_max_lot, P35W_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td>
    <td><input type="text" name="P33_max_lot_uom" id="P33_max_lot_uom" value="Lot" ></td>
    <td><b><input type="text" name="P33_max_doz" id="P33_max_doz"  value="<?php echo $P33_max_doz?>" onkeyup="return doz(this, P28_max_doz, P30_max_doz, P32_max_doz, P35_max_doz, P35M_max_doz, P35W_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)"></b></td>
    <td><input type="text" name="P33_max_doz_uom" id="P33_max_doz_uom" value="Doz" ></td>
    </tr> 
     
    <tr>
    <td><input type="text" name="P35" id="P35" value="P35"></td>
    <td><input type="text" name="P35_max_lot" id="P35_max_lot"  value="<?php echo $P35_max_lot?>"  onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P32_max_lot, P33_max_lot, P35M_max_lot, P35W_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td>
    <td><input type="text" name="P35_max_lot_uom" id="P35_max_lot_uom" value="Lot" ></td>
    <td><b><input type="text" name="P35_max_doz" id="P35_max_doz"  value="<?php echo $P35_max_doz?>"  onkeyup="return doz(this, P28_max_doz, P30_max_doz, P32_max_doz, P33_max_doz,P35M_max_doz, P35W_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)"></b></td>
    <td><input type="text" name="P35_max_doz_uom" id="P35_max_doz_uom" value="Doz" ></td>
    </tr>  

    <tr>
    <td><input type="text" name="P35M" id="P35M" value="P35M"></td>
    <td><input type="text" name="P35M_max_lot" id="P35M_max_lot" value="<?php echo $P35M_max_lot?>"  onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P32_max_lot, P33_max_lot, P35_max_lot, P35W_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td>
    <td><input type="text" name="P35M_max_lot_uom" id="P35M_max_lot_uom" value="Lot" ></td>
    <td><b><input type="text" name="P35M_max_doz" id="P35M_max_doz"  value="<?php echo $P35M_max_doz?>"  onkeyup="return doz(this, P28_max_doz, P30_max_doz, P32_max_doz, P33_max_doz,P35_max_doz, P35W_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)"></b></td>
    <td><input type="text" name="P35M_max_doz_uom" id="P35M_max_doz_uom" value="Doz" ></td>
    </tr>  

    <tr>
    <td><input type="text" name="P35W" id="P35W" value="P35W"></td>
    <td><input type="text" name="P35W_max_lot" id="P35W_max_lot"  value="<?php echo $P35W_max_lot?>"  onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P32_max_lot, P33_max_lot, P35_max_lot, P35M_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td>
    <td><input type="text" name="P35W_max_lot_uom" id="P35W_max_lot_uom" value="Lot" ></td>
    <td><b><input type="text" name="P35W_max_doz" id="P35W_max_doz"  value="<?php echo $P35W_max_doz?>"  onkeyup="return doz(this, P28_max_doz, P30_max_doz, P32_max_doz, P33_max_doz,P35_max_doz, P35M_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)"></b></td>
    <td><input type="text" name="P35W_max_doz_uom" id="P35W_max_doz_uom" value="Doz" ></td>
    </tr>  
    <tr>
    <td><input type="text" name="P38" id="P38" value="P38" ></td>
    <td><input type="text" name="P38_max_lot" id="P38_max_lot" value="<?php echo $P38_max_lot?>" size="8" onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P32_max_lot, P33_max_lot, P35_max_lot, P35M_max_lot, P35W_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td>
    <td><input type="text" name="P38_max_lot_uom" id="P38_max_lot_uom" value="Lot" ></td>
    <td><b><input type="text" name="P38_max_doz" id="P38_max_doz"  value="<?php echo $P38_max_doz?>" onkeyup="return doz(this, P28_max_doz, P30_max_doz, P32_max_doz, P33_max_doz,P35_max_doz, P35M_max_doz, P35W_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)"></b></td>
    <td><input type="text" name="P38_max_doz_uom" id="P38_max_doz_uom" value="Doz" ></td>
    </tr>  
    <tr>
    <td><input type="text" name="Total" id="Total" value="Total" ></td>

    <td><input type="text" name="Total_max_lot" id="Total_max_lot" value="<?php echo $Total_max_lot?>" ></td>
    <td><input type="text" name="Total_max_lot_uom" id="Total_max_lot_uom" value="Lot" ></td>
    <td><b><input type="text" name="Total_max_doz" id="Total_max_doz" value="<?php echo $Total_max_doz?>"></b></td>
    <td><input type="text" name="Total_max_doz_uom" id="Total_max_doz_uom" value="Doz" ></td>
    </tr>  
    </table>
    </div>
    </form>
    </body>
    </html>
    Can you do me additional favor?If you have time kindly visit this sitesnip />

    Thank you so much
    Attached Images Attached Images
    Last edited by guido2004; May 28, 2012 at 03:33. Reason: snipped out link

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,501
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    onkey is javascript, I've moved the thread to the JS forum

  3. #3
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,109
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Oh my, any time you find yourself repeating code that you know something's wrong.
    You may get in trouble for advertising in posts too, leave those links out of your posts.

    Don't Repeat Yourself.
    Code html5:
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>Half Shell</title>
    <link rel="stylesheet" type="text/css" href="kanban.css">
    </head>
    <body>
    <form name="loading_kanban" action="" method="post" id="loading_kanban">
      <table>
        <tr>
          <th>Compounds</th>
          <th>Max</th>
          <th>UoM</th>
          <th>Max</th>
          <th>UoM</th>
        </tr>
        <tr>
          <td><input name="P28" id="P28" value="P28"></td>
          <td><input name="P28_max_lot" id="P28_max_lot" value="1"></td>
          <td><input name="P28_max_lot_uom" id="P28_max_lot_uom" value="Lot"></td>
          <td><input name="P28_max_doz" id="P28_max_doz" value="1"></td>
          <td><input name="P28_max_doz_uom" id="P28_max_doz_uom" value="Doz"></td>
        </tr>
        <tr>
          <td><input name="P30" id="P30" value="P30"></td>
          <td><input name="P30_max_lot" id="P30_max_lot" value="1"></td>
          <td><input name="P30_max_lot_uom" id="P30_max_lot_uom" value="Lot"></td>
          <td><input name="P30_max_doz" id="P30_max_doz" value="1"></td>
          <td><input name="P30_max_doz_uom" id="P30_max_doz_uom" value="Doz"></td>
        </tr>
        <tr>
          <td><input name="P32" id="P32" value="P32"></td>
          <td><input name="P32_max_lot" id="P32_max_lot" value="1"></td>
          <td><input name="P32_max_lot_uom" id="P32_max_lot_uom" value="Lot"></td>
          <td><input name="P32_max_doz" id="P32_max_doz" value="1"></td>
          <td><input name="P32_max_doz_uom" id="P32_max_doz_uom" value="Doz"></td>
        </tr>
        <tr>
          <td><input name="P33" id="P33" value="P33"></td>
          <td><input name="P33_max_lot" id="P33_max_lot" value="1"></td>
          <td><input name="P33_max_lot_uom" id="P33_max_lot_uom" value="Lot"></td>
          <td><input name="P33_max_doz" id="P33_max_doz" value="1"></td>
          <td><input name="P33_max_doz_uom" id="P33_max_doz_uom" value="Doz"></td>
        </tr>
        <tr>
          <td><input name="P35" id="P35" value="P35"></td>
          <td><input name="P35_max_lot" id="P35_max_lot" value="1"></td>
          <td><input name="P35_max_lot_uom" id="P35_max_lot_uom" value="Lot"></td>
          <td><input name="P35_max_doz" id="P35_max_doz" value="1"></td>
          <td><input name="P35_max_doz_uom" id="P35_max_doz_uom" value="Doz"></td>
        </tr>
        <tr>
          <td><input name="P35M" id="P35M" value="P35M"></td>
          <td><input name="P35M_max_lot" id="P35M_max_lot" value="1"></td>
          <td><input name="P35M_max_lot_uom" id="P35M_max_lot_uom" value="Lot"></td>
          <td><input name="P35M_max_doz" id="P35M_max_doz" value="1"></td>
          <td><input name="P35M_max_doz_uom" id="P35M_max_doz_uom" value="Doz"></td>
        </tr>
        <tr>
          <td><input name="P35W" id="P35W" value="P35W"></td>
          <td><input name="P35W_max_lot" id="P35W_max_lot" value="1"></td>
          <td><input name="P35W_max_lot_uom" id="P35W_max_lot_uom" value="Lot"></td>
          <td><input name="P35W_max_doz" id="P35W_max_doz" value="1"></td>
          <td><input name="P35W_max_doz_uom" id="P35W_max_doz_uom" value="Doz"></td>
        </tr>
        <tr>
          <td><input name="P38" id="P38" value="P38"></td>
          <td><input name="P38_max_lot" id="P38_max_lot" value="1" size="8"></td>
          <td><input name="P38_max_lot_uom" id="P38_max_lot_uom" value="Lot"></td>
          <td><input name="P38_max_doz" id="P38_max_doz" value="1"></td>
          <td><input name="P38_max_doz_uom" id="P38_max_doz_uom" value="Doz"></td>
        </tr>
        <tr>
          <td><input name="Total" id="Total" value="Total"></td>
          <td><input name="Total_max_lot" id="Total_max_lot" value="1"></td>
          <td><input name="Total_max_lot_uom" id="Total_max_lot_uom" value="Lot"></td>
          <td><input name="Total_max_doz" id="Total_max_doz" value="1"></td>
          <td><input name="Total_max_doz_uom" id="Total_max_doz_uom" value="Doz"></td>
        </tr>
      </table>
    </form>
    <script>
    var P28_max_convert = (parseFloat(P28_max_lot) * ((parseFloat(P28_bch_wt))* parseFloat(1000)) / parseFloat(P28_plug_wt) / parseFloat(12));
    if (!isNaN(P28_max_convert)) {
      var P28_max_doz = document.getElementById("P28_max_doz").value = P28_max_convert.toFixed(2);
    }
    if (isNaN(oText.value)) {
      alert('Numbers only!');
      oText.value = '';
    }
    function doz(oText) {
      if (isNaN(oText.value)) {
        oText.value = '';
      } 
      var field, val, oForm = oText.form, Total_max_doz = a = 0;
      for (a; a < arguments.length; ++a) {
        field = arguments[a];
        val = parseFloat(field.value);
        if (!isNaN(val)) {
          Total_max_doz += val; 
        }
      }
      oForm.Total_max_doz.value = Total_max_doz.toFixed(2);
    }
    </script>
    </body>
    </html>
    I've kept the part of the script that wasn't repeated, now what do you want it to do?

  4. #4
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,109
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    If the only thing in the table that you want the users to edit is the 'max lot' then those are the only cells you need inputs for as well.
    Code html5:
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>Half Shell</title>
    <link rel="stylesheet" type="text/css" href="kanban.css">
    </head>
    <body>
    <form name="loading_kanban" action="" method="post" id="loading_kanban">
      <table>
        <thead>
          <tr>
            <th>Compounds</th>
            <th>Max</th>
            <th>UoM</th>
            <th>Max</th>
            <th>UoM</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>P28</td>
            <td><input name="P28_max" value="10"></td>
            <td>Lot</td>
            <td>2278.22</td>
            <td>Doz</td>
          </tr>
          <tr>
            <td>P30</td>
            <td><input name="P30_max" value="4"></td>
            <td>Lot</td>
            <td>916.07</td>
            <td>Doz</td>
          </tr>
          <tr>
            <td>P32</td>
            <td><input name="P32_max" value="20"></td>
            <td>Lot</td>
            <td>4273.27</td>
            <td>Doz</td>
          </tr>
          <tr>
            <td>P33</td>
            <td><input name="P33_max" value="5"></td>
            <td>Lot</td>
            <td>1154.50</td>
            <td>Doz</td>
          </tr>
          <tr>
            <td>P35</td>
            <td><input name="P35_max" value="0"></td>
            <td>Lot</td>
            <td>0.00</td>
            <td>Doz</td>
          </tr>
          <tr>
            <td>P35M</td>
            <td><input name="P35M_max" value="0"></td>
            <td>Lot</td>
            <td>0.00</td>
            <td>Doz</td>
          </tr>
          <tr>
            <td>P35W</td>
            <td><input name="P35W_max" value="7"></td>
            <td>Lot</td>
            <td>1255.42</td>
            <td>Doz</td>
          </tr>
          <tr>
            <td>P38</td>
            <td><input name="P38_max" value="4"></td>
            <td>Lot</td>
            <td>915.11</td>
            <td>Doz</td>
          </tr>
        </tbody>
        <tfoot>
          <tr>
            <td>Total</td>
            <td></td>
            <td>Lot</td>
            <td></td>
            <td>Doz</td>
          </tr>
        </tfoot>
      </table>
    </form>
    <script>
    var P28_max_convert = (parseFloat(P28_max) * ((parseFloat(P28_bch_wt))* parseFloat(1000)) / parseFloat(P28_plug_wt) / parseFloat(12));
    if (!isNaN(P28_max_convert)) {
      var P28_max_doz = document.getElementById("P28_max_doz").value = P28_max_convert.toFixed(2);
    }
    if (isNaN(oText.value)) {
      alert('Numbers only!');
      oText.value = '';
    }
    function doz(oText) {
      if (isNaN(oText.value)) {
        oText.value = '';
      } 
      var field, val, oForm = oText.form, Total_max_doz = a = 0;
      for (a; a < arguments.length; ++a) {
        field = arguments[a];
        val = parseFloat(field.value);
        if (!isNaN(val)) {
          Total_max_doz += val; 
        }
      }
      oForm.Total_max_doz.value = Total_max_doz.toFixed(2);
    }
    </script>
    </body>
    </html>


Bookmarks

Posting Permissions

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