Jump to content

help with a single function handling multiple forms


glennn.php

Recommended Posts

i'd like to make this function - mult1() - work on several similar forms like the ones below:

function mult1()
{
// Get values from form
var monthly,often;
mo = document.getElementById('monthly').value;
oft = document.getElementById('often').value;

// Compute the product.
var product = mo*oft;

// Display product in form.
// document.wizForm.sc1_net.value = product;
document.getElementById('net').value = product;
}


<div class="row">   
    <div class="row1">Source 1</div>  
    <div class="row2"><input type="text" name="sc1_mo" id="monthly1" /></div> 
    <div class="row3">
      <select name="sc1_oft" id="often1" onChange="mult1()">
      <option name="" value="4">Weekly</option>
      <option name="" value="2">Every 2 Weeks</option>
      <option name="" value="2">Bi-Monthly</option>
      <option name="" value="1">Monthly</option>
      </select>
    </div>  
    <div class="row4">
      <input name="sc1_net" id="net1" type="text" readonly />
    </div> 
    </div>

<div class="row">   
    <div class="row1">Source 1</div>  
    <div class="row2"><input type="text" name="sc2_mo" id="monthly2" /></div> 
    <div class="row3">
      <select name="sc2_oft" id="often2" onChange="mult1()">
      <option name="" value="4">Weekly</option>
      <option name="" value="2">Every 2 Weeks</option>
      <option name="" value="2">Bi-Monthly</option>
      <option name="" value="1">Monthly</option>
      </select>
    </div>  
    <div class="row4">
      <input name="sc2_net" id="net2" type="text" readonly />
    </div> 
    </div>



 

not too good with javascript, i appreciate any help...

 

 

thanks again,

GN

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.