Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New Coder
    Join Date
    Dec 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Another JS calcutation question..

    Hi all,

    Thank you all so much for your help so far.

    The script contains panels (there will be a lot more than whats there now) with various components repeated in the panels. Each component has an associated price. If the price of a component changes, this means that I will have to update the price right throughout the script. This leaves me open to missing one.
    Is there any way I can get the individual components to read their price from a master price i.e when I change the master all the rest will change??

    Example component:
    <option value="5.73" selected>Male XLR</option>
    This appears is several locations so it would be great to change one price for this and they all change

    Any other suggestion very welcome as I'm really scraping my way through this but having a bit of fun learning.

    Anto

    Code:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <SCRIPT LANGUAGE="JavaScript">

    <!-- Begin
    function doMath(s) {
    var form = document.getElementsByName(s)[0];
    var one = parseFloat(form.con1.value);
    var two = parseFloat(form.cable.value);
    var three = parseFloat(form.length.value);
    var four = parseFloat(form.con2.value);
    var five = 0.0;
    if (form.con3) {
    five = parseFloat(form.con3.value);
    }
    var prod = (two * three) + one + four + five;

    form.amount.value=custRound(prod,3);
    }

    function custRound(x,places) {
    return (Math.round(x*Math.pow(10,places)))/Math.pow(10,places)
    }

    // End -->


    </SCRIPT>


    </head>

    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


    </head>

    <body bgcolor="#000000" text="#000000">
    <CENTER>
    <FORM NAME="single">
    <table width="64%" border="0">
    <tr>
    <td><div align="center"><font color="#CCCCCC" size="4" face="Verdana, Arial, Helvetica, sans-serif"><strong><em><u>Single
    Cables</u></em></strong></font></div></td>
    </tr>
    </table>
    <table width="58%" height="111" border="0" bordercolor="#FFFFFF" bgcolor="#000000">
    <tr>
    <td height="107"><div align="center">
    <table width="609" height="105" border="0" cellspacing="0">
    <tr bgcolor="#FFCC66">
    <td width="177" height="27" valign="bottom" bgcolor="#3399CC"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif">--Connector
    1-- </font></div></td>
    <td width="132" valign="bottom" bgcolor="#3399CC"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif">--Cable
    Type-- </font></div></td>
    <td width="126" valign="bottom" bgcolor="#3399CC"><p align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif">--Length/Meter--</font></p></td>
    <td width="166" valign="bottom" bgcolor="#3399CC"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif">--Connector
    2--<u> </u></font></div></td>
    </tr>
    <tr valign="top" bgcolor="#FFCC66">
    <td height="31" bgcolor="#3399CC"> <div align="center"> <strong><font size="3" face="Times New Roman, Times, serif">
    <select name="con1">
    <option value="5.73" selected>Male XLR</option>
    <option value="6.26">Female XLR</option>
    <option value="6.83">Stereo Jack (TRS)</option>
    <option value="5.70">Mono Jack</option>
    <option value="4.05">Phono (RCA)</option>
    <option value="4.05">Minijack</option>
    </select>
    </font></strong></div></td>
    <td bgcolor="#3399CC"><div align="center"> <strong><font size="3" face="Times New Roman, Times, serif">
    <select name="cable">
    <option value="2.05">Gotham Cable</option>
    <option value="1.05">Cordial Cable</option>
    <option value=".45">Install Cable</option>
    </select>
    </font></strong></div></td
    >
    <td bgcolor="#3399CC"><div align="center"> <strong><font size="3" face="Times New Roman, Times, serif">
    <input name="length" type="text" size="5">
    </font></strong></div></td>
    <td bgcolor="#3399CC"><div align="center"> <font size="3" face="Times New Roman, Times, serif">
    <select name="con2">
    <option value="5.73" selected>Male XLR</option>
    <option value="6.26">Female XLR</option>
    <option value="6.83">Stereo Jack (TRS)</option>
    <option value="5.70">Mono Jack</option>
    <option value="4.05">Phono (RCA)</option>
    <option value="4.05">Minijack</option>
    </select>
    </font></div></td>
    </tr>
    <tr bgcolor="#FFCC66">
    <td height="21" bgcolor="#3399CC">&nbsp; </td>
    <td bgcolor="#333333"> <div align="center"> <strong><font size="3" face="Times New Roman, Times, serif">
    </font></strong></div></td>
    <td height="21" valign="bottom" bgcolor="#333333"><div align="center"><strong><font color="#FFFFFF">Total
    &euro;</font></strong></div></td>
    <td valign="bottom" bgcolor="#3399CC"><div align="center"></div></td>
    </tr>
    <tr bgcolor="#FFCC66">
    <td height="26" bgcolor="#3399CC">&nbsp;</td>
    <td valign="bottom" bgcolor="#333333"><div align="center"><strong><font size="3" face="Times New Roman, Times, serif">
    <input type="button" value="Calculate" onClick="doMath('single')" name="button">
    </font></strong></div></td>
    <td height="26" bgcolor="#333333"><div align="center"><strong><font size="3" face="Times New Roman, Times, serif">
    <input name="amount" value="0.00" type="text" size="7" class="totalBox" readonly>
    </font></strong></div></td>
    <td bgcolor="#3399CC"><div align="center"> <strong></strong></div></td>
    </tr>
    </table>
    </div></td>
    </tr>
    </table>
    </FORM>
    <FORM NAME="Yleads">
    <table width="75%" border="0">
    <tr>
    <td><div align="center"><strong><font color="#CCCCCC" size="4" face="Verdana, Arial, Helvetica, sans-serif"><strong><em><u>Y-leads</u></em></strong></font></strong></div></td>
    </tr>
    </table>
    <table width="58%" height="171" border="0" bgcolor="#000000">
    <tr>
    <td height="167"><div align="center">
    <table width="606" height="159" border="0" cellspacing="0">
    <tr bgcolor="#3399CC">
    <td width="176" height="29" valign="bottom">&nbsp;</td>
    <td width="135" valign="bottom">&nbsp;</td>
    <td width="124" valign="bottom">&nbsp;</td>
    <td width="163" valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif">--Connector
    2--</font></div></td>
    </tr>
    <tr valign="top" bgcolor="#3399CC">
    <td height="26" valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif">--Connector
    1-- </font></div></td>
    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif">--Cable
    Type-- </font></div></td>
    <td valign="bottom"><p align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif">--Length/Meter--</font></p></td>
    <td> <div align="center"><strong><font size="3" face="Times New Roman, Times, serif">
    <select name="con2">
    <option value="5.73" selected>Male XLR</option>
    <option value="6.26">Female XLR</option>
    <option value="6.83">Stereo Jack (TRS)</option>
    <option value="5.70">Mono Jack</option>
    <option value="4.05">Phono (RCA)</option>
    <option value="4.05">Minijack</option>
    </select>
    </font ></strong></div></td>
    </tr>
    <tr bgcolor="#3399CC">
    <td height="26" valign="top"> <div align="center"> <strong><font size="3" face="Times New Roman, Times, serif">
    <select name="con1">
    <option value="5.73" selected>Male XLR</option>
    <option value="6.26">Female XLR</option>
    <option value="6.83">Stereo Jack (TRS)</option>
    <option value="5.70">Mono Jack</option>
    <option value="4.05">Phono (RCA)</option>
    <option value="4.05">Minijack</option>
    </select>
    </font></strong></div></td>
    <td valign="top"><div align="center"> <strong><font size="3" face="Times New Roman, Times, serif">
    <select name="cable">
    <option value=".90">Install cable</option>
    </select>
    </font></strong></div></td
    >
    <td valign="top"> <div align="center"> <strong><font size="3" face="Times New Roman, Times, serif">
    <input name="length" type="text" size="5">
    </font></strong></div></td>
    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif">--Connector
    3--<u> </u></font></div></td>
    </tr>
    <tr bgcolor="#3399CC">
    <td height="30">&nbsp;</td>
    <td>&nbsp;</td>
    <td height="30"><div align="center"></div></td>
    <td valign="top"><div align="center"> <strong><font size="3" face="Times New Roman, Times, serif">
    <select name="con3">
    <option value="5.73" selected>Male XLR</option>
    <option value="6.26">Female XLR</option>
    <option value="6.83">Stereo Jack (TRS)</option>
    <option value="5.70">Mono Jack</option>
    <option value="4.05">Phono (RCA)</option>
    <option value="4.05">Minijack</option>
    </select>
    </font></strong></div></td>
    </tr>
    <tr bgcolor="#3399CC">
    <td height="21">&nbsp;</td>
    <td bgcolor="#333333"><div align="center"></div></td>
    <td height="21" valign="bottom" bgcolor="#333333"><div align="center"><strong><font color="#FFFFFF">Total
    &euro;</font></strong></div></td>
    <td valign="bottom"> <div align="center"></div></td>
    </tr>
    <tr bgcolor="#3399CC">
    <td height="26">&nbsp;</td>
    <td height="26" bgcolor="#333333"><div align="center"><strong><font size="3" face="Times New Roman, Times, serif">
    <input type="button" value="Calculate" onClick="doMath('Yleads')" name="button2">
    </font></strong></div></td>
    <td bgcolor="#333333"> <div align="center"><strong><font size="3" face="Times New Roman, Times, serif">
    <input name="amount" value="0.00" type="text" size="7" class="totalBox" readonly>
    </font></strong></div></td>
    <td>&nbsp;</td>
    </tr>
    </table>
    </div></td>
    </tr>
    </table>
    </FORM>
    <FORM NAME="4pair">
    <table width="64%" border="0">
    <tr>
    <td><div align="center"><font color="#CCCCCC" size="4" face="Verdana, Arial, Helvetica, sans-serif"><strong><em><u>4
    Pair </u></em></strong></font></div></td>
    </tr>
    </table>
    <table width="58%" height="111" border="0" bordercolor="#FFFFFF" bgcolor="#000000">
    <tr>
    <td height="107"><div align="center">
    <table width="609" height="105" border="0" cellspacing="0">
    <tr bgcolor="#FFCC66">
    <td width="177" height="27" valign="bottom" bgcolor="#3399CC"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif">--Connector
    1-- </font></div></td>
    <td width="132" valign="bottom" bgcolor="#3399CC"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif">--Cable
    Type-- </font></div></td>
    <td width="126" valign="bottom" bgcolor="#3399CC"><p align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif">--Length/Meter--</font></p></td>
    <td width="166" valign="bottom" bgcolor="#3399CC"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif">--Connector
    2--<u> </u></font></div></td>
    </tr>
    <tr valign="top" bgcolor="#FFCC66">
    <td height="31" bgcolor="#3399CC"> <div align="center"> <strong><font size="3" face="Times New Roman, Times, serif">
    <select name="con1">
    <option value="5.73" selected>Male XLR</option>
    <option value="6.26">Female XLR</option>
    <option value="6.83">Stereo Jack (TRS)</option>
    <option value="5.70">Mono Jack</option>
    <option value="4.05">Phono (RCA)</option>
    <option value="4.05">Minijack</option>
    </select>
    </font></strong></div></td>
    <td bgcolor="#3399CC"><div align="center"> <strong><font size="3" face="Times New Roman, Times, serif">
    <select name="cable">
    <option value="3.75">4pair</option>
    </select>
    </font></strong></div></td
    >
    <td bgcolor="#3399CC"><div align="center"> <strong><font size="3" face="Times New Roman, Times, serif">
    <input name="length" type="text" size="5">
    </font></strong></div></td>
    <td bgcolor="#3399CC"><div align="center"> <font size="3" face="Times New Roman, Times, serif">
    <select name="con2">
    <option value="5.73" selected>Male XLR</option>
    <option value="6.26">Female XLR</option>
    <option value="6.83">Stereo Jack (TRS)</option>
    <option value="5.70">Mono Jack</option>
    <option value="4.05">Phono (RCA)</option>
    <option value="4.05">Minijack</option>
    </select>
    </font></div></td>
    </tr>
    <tr bgcolor="#FFCC66">
    <td height="21" bgcolor="#3399CC">&nbsp; </td>
    <td bgcolor="#333333"> <div align="center"> <strong><font size="3" face="Times New Roman, Times, serif">
    </font></strong></div></td>
    <td height="21" valign="bottom" bgcolor="#333333"><div align="center"><strong><font color="#FFFFFF">Total
    &euro;</font></strong></div></td>
    <td valign="bottom" bgcolor="#3399CC"><div align="center"></div></td>
    </tr>
    <tr bgcolor="#FFCC66">
    <td height="26" bgcolor="#3399CC">&nbsp;</td>
    <td valign="bottom" bgcolor="#333333"><div align="center"><strong><font size="3" face="Times New Roman, Times, serif">
    <input type="button" value="Calculate" onClick="doMath('4pair')" name="button">
    </font></strong></div></td>
    <td height="26" bgcolor="#333333"><div align="center"><strong><font size="3" face="Times New Roman, Times, serif">
    <input name="amount" value="0.00" type="text" size="7" class="totalBox" readonly>
    </font></strong></div></td>
    <td bgcolor="#3399CC"><div align="center"> <strong></strong></div></td>
    </tr>
    </table>
    </div></td>
    </tr>
    </table>
    </FORM>

    </CENTER>


    </body>
    </html>

  • #2
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Next time I recommend you use the CODE button to post code. It is the # button right above the text entry.

    Anyway, here is an example I put together from your last post of code. Basically, when the page loads it goes through every <option> tag and updates it based on the text to a price. I set all the prices to "0.00" and put an alert if one isn't updated (I commented out one to test it).

    One other thing I did was add isNaN() to your length to make sure the user typed in a valid number otherwise it sets the length to 0.0 for the calculation. If you wanted to you could return an error instead.

    Hope that helps.

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <SCRIPT LANGUAGE="JavaScript">
    
    <!-- Begin
    
    var aPriceList = [
      [ "Male XLR", 5.73 ],
      [ "Female XLR", 6.26 ],
      [ "Stereo Jack (TRS)", 6.83 ],
      [ "Mono Jack", 5.70 ],
      [ "Phono (RCA)", 4.05 ],
      [ "Minijack", 4.05 ],
    //  [ "Gotham GAC-3", 2.05 ],
      [ "Cordial CMK222", 1.05 ]
    ];
    
    function  doMath(s) {
      var form = document.getElementsByName(s)[0];
      var one = parseFloat(form.con1.value);
      var two = parseFloat(form.cable.value);  
      var three = parseFloat(form.length.value);
      if (isNaN(three)) {
        three = 0.0;
      }
      var four = parseFloat(form.con2.value); 
      var five = 0.0;
      if (form.con3) {
        five = parseFloat(form.con3.value);
      }
      var prod = (two * three) + one + four + five;
    
      form.amount.value=custRound(prod,3);
    }
    
    function custRound(x,places) {
      return (Math.round(x*Math.pow(10,places)))/Math.pow(10,places)
    }
    
    function findPrice(op) {
      for (var i = 0; i < aPriceList.length; i++) {
        if (op.text == aPriceList[i][0]) {
          op.value = aPriceList[i][1];
          break;
        }
      }
    
      if (i >= aPriceList.length) {
        alert("No price found for " + op.text + "!");
      }
    }
    
    function updatePrices() {
      var ops = document.getElementsByTagName("option");
    
      for (var i = 0; i < ops.length; i++) {
        findPrice(ops[i]);
      }
    }
    
    window.onload = function () {
      updatePrices();
    }
    
    // End -->
    
    
    </SCRIPT>
    
    </head>
    
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    
    </head>
    
    <body bgcolor="#FFFFFF" text="#000000">
    <CENTER>
    <FORM NAME="single">
        <table width="75%" border="1">
          <tr>
            <td height="490"><div align="center"> 
                <table width="75%" border="0">
                  <tr>
                    <td width="22%">&nbsp;</td>
                    <td width="53%"><div align="center"><font color="#333333" size="+1"></font></div></td>
                    <td width="25%">&nbsp;</td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                </table>
                <table width="75%" border="0">
                  <tr>
                    <td><div align="center"><font color="#333333" size="5" face="Geneva, Arial, Helvetica, sans-serif">Single 
                        Cables</font></div></td>
                  </tr>
                </table>
                <table width="75%" border="1" bgcolor="#333333">
                  <tr>
                    <td height="84"><div align="center">
                        <table width="673" height="120" border="0" cellspacing="0">
                          <tr> 
                            <td height="18" valign="bottom"><div align="center"><font color="#666666" size="2" face="Geneva, Arial, Helvetica, sans-serif"><strong>Connector 
                                type (1) </strong></font></div></td>
                            <td valign="bottom"><div align="center"><font color="#666666" size="2" face="Geneva, Arial, Helvetica, sans-serif"><strong>Cable 
                                Type </strong></font></div></td>
                            <td valign="bottom"><p align="center"><font color="#666666" size="2" face="Geneva, Arial, Helvetica, sans-serif"><strong>Lenght 
                                per mtr. </strong></font></p></td>
                            <td valign="bottom"><div align="center"><font color="#666666" size="2" face="Geneva, Arial, Helvetica, sans-serif"><strong>Connector 
                                type (2) </strong></font></div></td>
                          </tr>
                          <tr valign="top"> 
                            <td height="26"> <div align="center"> 
                                <select name="con1">
                                  <option value="0.00" selected>Male XLR</option>
                                  <option value="0.00">Female XLR</option>
                                  <option value="0.00">Stereo Jack (TRS)</option>
                                  <option value="0.00">Mono Jack</option>
                                  <option value="0.00">Phono (RCA)</option>
                                  <option value="0.00">Minijack</option>
                                </select>
                              </div></td>
                            <td><div align="center"> 
                                <select name="cable">
                                  <option value="0.00">Gotham GAC-3</option>
                                  <option value="0.00">Cordial CMK222</option>
                                </select>
                              </div></td
            >
                            <td><div align="center"> 
                                <input name="length" type="text" size="5">
                              </div></td>
                            <td><div align="center"> 
                                <select name="con2">
                                  <option value="0.00" selected>Male XLR</option>
                                  <option value="0.00">Female XLR</option>
                                  <option value="0.00">Stereo Jack (TRS)</option>
                                  <option value="0.00">Mono Jack</option>
                                  <option value="0.00">Phono (RCA)</option>
                                  <option value="0.00">Minijack</option>
                                </select>
                              </div></td>
                          </tr>
                          <tr> 
                            
                        <td height="71">&nbsp; </td>
                            <td> <div align="center"> 
                                <input type="button" value="Calculate" onClick="doMath('single')" name="button">
                              </div></td>
                            <td><div align="right"><strong><font color="#FF0000" face="Verdana, Arial, Helvetica, sans-serif">Total----</font></strong> 
                              </div></td>
                            <td><div align="center"> 
                                <input name="amount" type="text" size="10">
                              </div></td>
                          </tr>
                        </table>
                      </div></td>
                  </tr>
                </table>
          </FORM>
      
          <FORM NAME="Yleads">
        <table width="75%" border="1">
          <tr>
            <td height="490"><div align="center"> 
                <table width="75%" border="0">
                  <tr>
                    <td width="22%">&nbsp;</td>
                    <td width="53%"><div align="center"><font color="#333333" size="+1"></font></div></td>
                    <td width="25%">&nbsp;</td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                </table>
                <table width="75%" border="0">
                  <tr>
                    <td><div align="center"><font color="#333333" size="5" face="Geneva, Arial, Helvetica, sans-serif">Yleads</font></div></td>
                  </tr>
                </table>
                <table width="75%" height="214" border="1" bgcolor="#333333">
                  <tr>
                    <td height="170"><div align="center">
                        
                    <table width="673" height="157" border="0" cellspacing="0">
                      <tr> 
                        <td height="26" valign="bottom"><div align="center"><font color="#666666" size="2" face="Geneva, Arial, Helvetica, sans-serif"><strong>Connector 
                            type (1) </strong></font></div></td>
                        <td valign="bottom"><div align="center"><font color="#666666" size="2" face="Geneva, Arial, Helvetica, sans-serif"><strong>Cable 
                            Type </strong></font></div></td>
                        <td valign="bottom"><p align="center"><font color="#666666" size="2" face="Geneva, Arial, Helvetica, sans-serif"><strong>Lenght 
                            per mtr. </strong></font></p></td>
                        <td valign="bottom"><div align="center"><font color="#666666" size="2" face="Geneva, Arial, Helvetica, sans-serif"><strong>Connector 
                            type (2) </strong></font></div></td>
                      </tr>
                      <tr valign="top"> 
                        <td height="26"> <div align="center"> 
                            <select name="con1">
                              <option value="0.00" selected>Male XLR</option>
                              <option value="0.00">Female XLR</option>
                              <option value="0.00">Stereo Jack (TRS)</option>
                              <option value="0.00">Mono Jack</option>
                              <option value="0.00">Phono (RCA)</option>
                              <option value="0.00">Minijack</option>
                            </select>
                          </div></td>
                        <td><div align="center"> 
                            <select name="cable">
                              <option value="0.00">Gotham GAC-3</option>
                              <option value="0.00">Cordial CMK222</option>
                            </select>
                          </div></td>
                        <td><div align="center"> 
                            <input name="length" type="text" size="5">
                          </div></td>
                        <td><div align="center"> 
                            <select name="con2">
                              <option value="0.00" selected>Male XLR</option>
                              <option value="0.00">Female XLR</option>
                              <option value="0.00">Stereo Jack (TRS)</option>
                              <option value="0.00">Mono Jack</option>
                              <option value="0.00">Phono (RCA)</option>
                              <option value="0.00">Minijack</option>
                            </select>
                          </div></td>
                      </tr>
                      <tr> 
                        <td height="71" rowspan="4">&nbsp; </td>
                        <td rowspan="4"> <div align="center"> 
                            <input type="button" value="Calculate" onClick="doMath('Yleads')" name="button">
                          </div></td>
                        <td height="21"><div align="right"><strong></strong> </div></td>
                        <td><div align="center"><font color="#666666" size="2" face="Geneva, Arial, Helvetica, sans-serif"><strong>Connector 
                            type (3) </strong></font></div></td>
                      </tr>
                      <tr> 
                        <td height="26"><div align="center"></div></td>
                        <td><div align="center"> 
                            <select name="con3">
                              <option value="0.00" selected>Male XLR</option>
                              <option value="0.00">Female XLR</option>
                              <option value="0.00">Stereo Jack (TRS)</option>
                              <option value="0.00">Mono Jack</option>
                              <option value="0.00">Phono (RCA)</option>
                              <option value="0.00">Minijack</option>
                            </select>
                          </div></td>
                      </tr>
                      <tr> 
                        <td height="21"><div align="right"><strong></strong></div></td>
                        <td> <div align="center"></div></td>
                      </tr>
                      <tr> 
                        <td height="13"><div align="right"><strong><font color="#FF0000" face="Verdana, Arial, Helvetica, sans-serif">Total----</font></strong></div></td>
                        <td> <div align="center"> 
                            <input name="amount" type="text" size="10">
                          </div></td>
                      </tr>
                    </table>
                      </div></td>
                  </tr>
                </table>
          </FORM>
        
          </CENTER>
    
    
    </body>
    </html>
    david_kw

  • #3
    New Coder
    Join Date
    Dec 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is great, it really has given me a huge help..

    Many thanks

    Anto

  • #4
    New Coder
    Join Date
    Dec 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi again,

    Nearly there. The help I've been given so far is amazing. I think I've come to the final hurdle and once again I'm coming running to get a little help.

    In the third panel of the script, the price for 'Connector 1' & 'Connector 2' needs to be multiplied by four. There will be further panels with multiples of 8,16,24 also. I just realised how many variables I would have to put in to do this manually. Is there something I could add into the options line or will a function be needed?

    Thanks again

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <SCRIPT LANGUAGE="JavaScript">
    
    <!-- Begin
    
    var aPriceList = [
      [ "Male XLR", 5.73 ],
      [ "Female XLR", 6.26 ],
      [ "Stereo Jack (TRS)", 6.83 ],
      [ "Mono Jack", 5.70 ],
      [ "Phono (RCA)", 4.05 ],
      [ "Minijack", 4.05 ],
      [ "Gotham GAC-3", 2.05 ],
      [ "Install", .45 ],
      [ "Cordial CMK222", 1.05 ],
      [ "4 Pair Multi", 2.85],
      [ "8 Pair Multi", 4.58],
      [ "16 Pair Multi", 7.30],
      [ "24 Pair Multi", 13.00]
    ];
    
    function  doMath(s) {
      var form = document.getElementsByName(s)[0];
      var one = parseFloat(form.con1.value);
      var two = parseFloat(form.cable.value);  
      var three = parseFloat(form.length.value);
      if (isNaN(three)) {
        three = 0.0;
      }
      var four = parseFloat(form.con2.value); 
      var five = 0.0;
      if (form.con3) {
        five = parseFloat(form.con3.value);
      }
      var prod = (two * three) + one + four + five;
    
      form.amount.value=custRound(prod,3);
    }
    
    function custRound(x,places) {
      return (Math.round(x*Math.pow(10,places)))/Math.pow(10,places)
    }
    
    function findPrice(op) {
      for (var i = 0; i < aPriceList.length; i++) {
        if (op.text == aPriceList[i][0]) {
          op.value = aPriceList[i][1];
          break;
        }
      }
    
      if (i >= aPriceList.length) {
        alert("No price found for " + op.text + "!");
      }
    }
    
    function updatePrices() {
      var ops = document.getElementsByTagName("option");
    
      for (var i = 0; i < ops.length; i++) {
        findPrice(ops[i]);
      }
    }
    
    window.onload = function () {
      updatePrices();
    }
    
    // End -->
    
    
    </SCRIPT>
    
    </head>
    
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    
    </head>
    
    <body bgcolor="#000000" text="#000000">
    <CENTER>
    <FORM NAME="single">
        <table width="75%" border="0">
                  <tr>
                    <td><div align="center"><font color="#999999" size="5" face="Geneva, Arial, Helvetica, sans-serif">Single 
                        Cables</font></div></td>
                  </tr>
                </table>
                <table width="60%" border="1" bgcolor="#333333">
                  <tr>
                    <td height="114"><div align="center">
                        
                <table width="673" height="110" border="0" cellspacing="0">
                  <tr bgcolor="#999966"> 
                    <td height="18" valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>---Connector 
                        1--- </strong></font></div></td>
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>---Cable 
                        Type--- </strong></font></div></td>
                    <td valign="bottom"><p align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>Lenght/Meter</strong></font></p></td>
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>---Connector 
                        2--- </strong></font></div></td>
                  </tr>
                  <tr valign="top" bgcolor="#999966"> 
                    <td height="35"> <div align="center"> 
                        <select name="con1">
                          <option value="0.00" selected>Male XLR</option>
                          <option value="0.00">Female XLR</option>
                          <option value="0.00">Stereo Jack (TRS)</option>
                          <option value="0.00">Mono Jack</option>
                          <option value="0.00">Phono (RCA)</option>
                          <option value="0.00">Minijack</option>
                        </select>
                      </div></td>
                    <td><div align="center"> 
                        <select name="cable">
                          <option value="0.00">Gotham GAC-3</option>
                          <option value="0.00">Cordial CMK222</option>
                        </select>
                      </div></td>
                    <td><div align="center"> 
                        <input name="length" type="text" size="5">
                      </div></td>
                    <td><div align="center"> 
                        <select name="con2">
                          <option value="0.00" selected>Male XLR</option>
                          <option value="0.00">Female XLR</option>
                          <option value="0.00">Stereo Jack (TRS)</option>
                          <option value="0.00">Mono Jack</option>
                          <option value="0.00">Phono (RCA)</option>
                          <option value="0.00">Minijack</option>
                        </select>
                      </div></td>
                  </tr>
                  <tr bgcolor="#999966"> 
                    <td height="21">&nbsp; </td>
                    <td>&nbsp;</td>
                    <td valign="bottom"><div align="center"><strong><font color="#CCCCCC" face="Verdana, Arial, Helvetica, sans-serif">Total 
                        &euro; </font></strong></div></td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr bgcolor="#999966"> 
                    <td height="26">&nbsp;</td>
                    <td> <div align="center"> 
                        <input type="button" value="Calculate" onClick="doMath('single')" name="button">
                      </div></td>
                    <td><div align="center"> 
                        <input name="amount" type="text" size="10">
                      </div></td>
                    <td>&nbsp;</td>
                  </tr>
                </table>
                      </div></td>
                  </tr>
                </table>
          </FORM>
      
          <FORM NAME="Yleads">
        <table width="75%" border="0">
                  <tr>
                    <td><div align="center"><font color="#999999" size="5" face="Geneva, Arial, Helvetica, sans-serif">Yleads</font></div></td>
                  </tr>
                </table>
                <table width="63%" height="166" border="1" bgcolor="#333333">
                  <tr>
                    <td height="160"><div align="center">
                        
                    
                <table width="673" height="156" border="0" cellspacing="0">
                  <tr bgcolor="#999966"> 
                    <td height="26" valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"></font></div></td>
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"></font></div></td>
                    <td valign="bottom"><p align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"></font></p></td>
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>---Connector 
                        2--- </strong></font></div></td>
                  </tr>
                  <tr valign="top" bgcolor="#999966"> 
                    <td height="26" valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>---Connector 
                        1--- </strong></font></div></td>
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>---Cable 
                        Type--- </strong></font></div></td>
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>Lenght/Meter</strong></font></div></td>
                    <td><div align="center"> 
                        <select name="con2">
                          <option value="0.00" selected>Male XLR</option>
                          <option value="0.00">Female XLR</option>
                          <option value="0.00">Stereo Jack (TRS)</option>
                          <option value="0.00">Mono Jack</option>
                          <option value="0.00">Phono (RCA)</option>
                          <option value="0.00">Minijack</option>
                        </select>
                      </div></td>
                  </tr>
                  <tr bgcolor="#999966">
                    <td height="26" valign="top"> <div align="center"> 
                        <select name="con1">
                          <option value="0.00" selected>Male XLR</option>
                          <option value="0.00">Female XLR</option>
                          <option value="0.00">Stereo Jack (TRS)</option>
                          <option value="0.00">Mono Jack</option>
                          <option value="0.00">Phono (RCA)</option>
                          <option value="0.00">Minijack</option>
                        </select>
                      </div></td>
                    <td valign="top"><div align="center"> 
                        <select name="cable">
                          <option value="0.00">Install</option>
                        </select>
                      </div></td>
                    <td valign="top"><div align="center"> 
                        <input name="length" type="text" size="5">
                      </div></td>
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>---Connector 
                        3--- </strong></font></div></td>
                  </tr>
                  <tr bgcolor="#999966"> 
                    <td height="26">&nbsp;</td>
                    <td>&nbsp;</td>
                    <td height="26"><div align="center"></div></td>
                    <td><div align="center"> 
                        <select name="con3">
                          <option value="0.00" selected>Male XLR</option>
                          <option value="0.00">Female XLR</option>
                          <option value="0.00">Stereo Jack (TRS)</option>
                          <option value="0.00">Mono Jack</option>
                          <option value="0.00">Phono (RCA)</option>
                          <option value="0.00">Minijack</option>
                        </select>
                      </div></td>
                  </tr>
                  <tr bgcolor="#999966"> 
                    <td height="21">&nbsp;</td>
                    <td>&nbsp;</td>
                    <td valign="bottom"><div align="center"><strong><font color="#CCCCCC" face="Verdana, Arial, Helvetica, sans-serif">Total 
                        &euro; </font></strong></div></td>
                    <td> <div align="center"></div></td>
                  </tr>
                  <tr bgcolor="#999966"> 
                    <td height="26">&nbsp;</td>
                    <td> <div align="center"> 
                        <input type="button" value="Calculate" onClick="doMath('Yleads')" name="button">
                      </div></td>
                    <td> <div align="center"> 
                        <input name="amount" type="text" size="10">
                      </div></td>
                    <td>&nbsp;</td>
                  </tr>
                </table>
                      </div></td>
                  </tr>
                </table>
          </FORM>
    	  
    	  <FORM NAME="4 Pair">
        <table width="75%" border="0">
                  <tr>
                    <td><div align="center"><font color="#999999" size="5" face="Geneva, Arial, Helvetica, sans-serif">4 
                Pair Multicores</font></div></td>
                  </tr>
                </table>
                <table width="60%" border="1" bgcolor="#333333">
                  <tr>
                    <td height="114"><div align="center">
                        
                <table width="673" height="110" border="0" cellspacing="0">
                  <tr bgcolor="#999966"> 
                    <td height="18" valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>--Connector 
                        1 (X4)-- </strong></font></div></td>
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>--Cable 
                        Type--</strong></font></div></td>
                    <td valign="bottom"><p align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>Lenght/Meter</strong></font></p></td>
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>--Connector 
                        2 (X4)--</strong></font></div></td>
                  </tr>
                  <tr valign="top" bgcolor="#999966"> 
                    <td height="35"> <div align="center"> 
                        <select name="con1">
                          <option value="0.00" selected>Male XLR</option>
                          <option value="0.00">Female XLR</option>
                          <option value="0.00">Stereo Jack (TRS)</option>
                          <option value="0.00">Mono Jack</option>
                          <option value="0.00">Phono (RCA)</option>
                          <option value="0.00">Minijack</option>
                        </select>
                      </div></td>
                    <td><div align="center"> 
                        <select name="cable">
                          <option value="0.00">4 Pair Multi</option>
                        </select>
                      </div></td>
                    <td><div align="center"> 
                        <input name="length" type="text" size="5">
                      </div></td>
                    <td><div align="center"> 
                        <select name="con2">
                          <option value="0.00" selected>Male XLR</option>
                          <option value="0.00">Female XLR</option>
                          <option value="0.00">Stereo Jack (TRS)</option>
                          <option value="0.00">Mono Jack</option>
                          <option value="0.00">Phono (RCA)</option>
                          <option value="0.00">Minijack</option>
                        </select>
                      </div></td>
                  </tr>
                  <tr bgcolor="#999966"> 
                    <td height="21">&nbsp; </td>
                    <td>&nbsp;</td>
                    <td valign="bottom"><div align="center"><strong><font color="#CCCCCC" face="Verdana, Arial, Helvetica, sans-serif">Total 
                        &euro; </font></strong></div></td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr bgcolor="#999966"> 
                    <td height="26">&nbsp;</td>
                    <td> <div align="center"> 
                        <input type="button" value="Calculate" onClick="doMath('4 Pair')" name="button">
                      </div></td>
                    <td><div align="center"> 
                        <input name="amount" type="text" size="10">
                      </div></td>
                    <td>&nbsp;</td>
                  </tr>
                </table>
                      </div></td>
                  </tr>
                </table>
          </FORM>
        
          </CENTER>
    
    
    </body>
    </html>

  • #5
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If I understand the problem correctly, I think you could techincally do something like this.

    Code:
    function findPrice(op) {
      var i;
    
      for (i = 0; i < aPriceList.length; i++) {
        if (op.text == aPriceList[i][0]) {
          op.value = (toFloat(aPriceList[i][1]) * toFloat(op.multiply)).toFixed(2);
          break;
        }
      }
    
      if (i >= aPriceList.length) {
        alert("No price found for " + op.text + "!");
      }
    }
    .
    .
    .
    <option value="5.73" multiply="4" selected>Male XLR</option>
    This totally untested so I could be wrong. Something like this should work though.

    david_kw

  • #6
    New Coder
    Join Date
    Dec 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    Thanks for that. It didn't seem to work though. It stoped the top two panels from working altogether and the calculations were wrong in the third panel.

    At this stage I think I might put in the prices manually as I feel I've taken up to much of your time already. (Unless you really want to)

    Thanks so much for your help. I really would have been totally lost without it.

    Anto

  • #7
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's what I get for trying to answer posts with untested code first thing in the morning after a long night.

    Notice that the Female XLR in the first panel has a multiply factor of 10. So try this:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <SCRIPT LANGUAGE="JavaScript">
    
    <!-- Begin
    
    var aPriceList = [
      [ "Male XLR", 5.73 ],
      [ "Female XLR", 6.26 ],
      [ "Stereo Jack (TRS)", 6.83 ],
      [ "Mono Jack", 5.70 ],
      [ "Phono (RCA)", 4.05 ],
      [ "Minijack", 4.05 ],
      [ "Gotham GAC-3", 2.05 ],
      [ "Install", .45 ],
      [ "Cordial CMK222", 1.05 ],
      [ "4 Pair Multi", 2.85],
      [ "8 Pair Multi", 4.58],
      [ "16 Pair Multi", 7.30],
      [ "24 Pair Multi", 13.00]
    ];
    
    function  doMath(s) {
      var form = document.getElementsByName(s)[0];
      var one = parseFloat(form.con1.value);
      var two = parseFloat(form.cable.value);  
      var three = parseFloat(form.length.value);
      if (isNaN(three)) {
        three = 0.0;
      }
      var four = parseFloat(form.con2.value); 
      var five = 0.0;
      if (form.con3) {
        five = parseFloat(form.con3.value);
      }
      var prod = (two * three) + one + four + five;
    
      form.amount.value=custRound(prod,3);
    }
    
    function custRound(x,places) {
      return (Math.round(x*Math.pow(10,places)))/Math.pow(10,places)
    }
    
    function findPrice(op) {
      var i;
    
      for (i = 0; i < aPriceList.length; i++) {
        if (op.text == aPriceList[i][0]) {
          var m_attr = op.getAttribute("multiply");
          var m = (m_attr) ? parseFloat(m_attr) : 1.00;
          op.value = (aPriceList[i][1] * m).toFixed(2);
          break;
        }
      }
    
      if (i >= aPriceList.length) {
        alert("No price found for " + op.text + "!");
      }
    }
    
    function updatePrices() {
      var ops = document.getElementsByTagName("option");
    
      for (var i = 0; i < ops.length; i++) {
        findPrice(ops[i]);
      }
    }
    
    window.onload = function () {
      updatePrices();
    }
    
    // End -->
    
    
    </SCRIPT>
    
    </head>
    
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    
    </head>
    
    <body bgcolor="#000000" text="#000000">
    <CENTER>
    <FORM NAME="single">
        <table width="75%" border="0">
                  <tr>
                    <td><div align="center"><font color="#999999" size="5" face="Geneva, Arial, Helvetica, sans-serif">Single 
                        Cables</font></div></td>
                  </tr>
                </table>
                <table width="60%" border="1" bgcolor="#333333">
    
                  <tr>
                    <td height="114"><div align="center">
                        
                <table width="673" height="110" border="0" cellspacing="0">
                  <tr bgcolor="#999966"> 
                    <td height="18" valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>---Connector 
                        1--- </strong></font></div></td>
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>---Cable 
                        Type--- </strong></font></div></td>
                    <td valign="bottom"><p align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>Lenght/Meter</strong></font></p></td>
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>---Connector 
                        2--- </strong></font></div></td>
    
                  </tr>
                  <tr valign="top" bgcolor="#999966"> 
                    <td height="35"> <div align="center"> 
                        <select name="con1">
                          <option value="0.00" selected>Male XLR</option>
                          <option value="0.00" multiply="10">Female XLR</option>
                          <option value="0.00">Stereo Jack (TRS)</option>
                          <option value="0.00">Mono Jack</option>
    
                          <option value="0.00">Phono (RCA)</option>
                          <option value="0.00">Minijack</option>
                        </select>
                      </div></td>
                    <td><div align="center"> 
                        <select name="cable">
                          <option value="0.00">Gotham GAC-3</option>
                          <option value="0.00">Cordial CMK222</option>
    
                        </select>
                      </div></td>
                    <td><div align="center"> 
                        <input name="length" type="text" size="5">
                      </div></td>
                    <td><div align="center"> 
                        <select name="con2">
                          <option value="0.00" selected>Male XLR</option>
                          <option value="0.00">Female XLR</option>
    
                          <option value="0.00">Stereo Jack (TRS)</option>
                          <option value="0.00">Mono Jack</option>
                          <option value="0.00">Phono (RCA)</option>
                          <option value="0.00">Minijack</option>
                        </select>
                      </div></td>
                  </tr>
    
                  <tr bgcolor="#999966"> 
                    <td height="21">&nbsp; </td>
                    <td>&nbsp;</td>
                    <td valign="bottom"><div align="center"><strong><font color="#CCCCCC" face="Verdana, Arial, Helvetica, sans-serif">Total 
                        &euro; </font></strong></div></td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr bgcolor="#999966"> 
                    <td height="26">&nbsp;</td>
    
                    <td> <div align="center"> 
                        <input type="button" value="Calculate" onClick="doMath('single')" name="button">
                      </div></td>
                    <td><div align="center"> 
                        <input name="amount" type="text" size="10">
                      </div></td>
                    <td>&nbsp;</td>
                  </tr>
                </table>
    
                      </div></td>
                  </tr>
                </table>
          </FORM>
      
          <FORM NAME="Yleads">
        <table width="75%" border="0">
                  <tr>
                    <td><div align="center"><font color="#999999" size="5" face="Geneva, Arial, Helvetica, sans-serif">Yleads</font></div></td>
    
                  </tr>
                </table>
                <table width="63%" height="166" border="1" bgcolor="#333333">
                  <tr>
                    <td height="160"><div align="center">
                        
                    
                <table width="673" height="156" border="0" cellspacing="0">
                  <tr bgcolor="#999966"> 
                    <td height="26" valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"></font></div></td>
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"></font></div></td>
    
                    <td valign="bottom"><p align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"></font></p></td>
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>---Connector 
                        2--- </strong></font></div></td>
                  </tr>
                  <tr valign="top" bgcolor="#999966"> 
                    <td height="26" valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>---Connector 
                        1--- </strong></font></div></td>
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>---Cable 
                        Type--- </strong></font></div></td>
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>Lenght/Meter</strong></font></div></td>
    
                    <td><div align="center"> 
                        <select name="con2">
                          <option value="0.00" selected>Male XLR</option>
                          <option value="0.00">Female XLR</option>
                          <option value="0.00">Stereo Jack (TRS)</option>
                          <option value="0.00">Mono Jack</option>
                          <option value="0.00">Phono (RCA)</option>
    
                          <option value="0.00">Minijack</option>
                        </select>
                      </div></td>
                  </tr>
                  <tr bgcolor="#999966">
                    <td height="26" valign="top"> <div align="center"> 
                        <select name="con1">
                          <option value="0.00" selected>Male XLR</option>
    
                          <option value="0.00">Female XLR</option>
                          <option value="0.00">Stereo Jack (TRS)</option>
                          <option value="0.00">Mono Jack</option>
                          <option value="0.00">Phono (RCA)</option>
                          <option value="0.00">Minijack</option>
                        </select>
    
                      </div></td>
                    <td valign="top"><div align="center"> 
                        <select name="cable">
                          <option value="0.00">Install</option>
                        </select>
                      </div></td>
                    <td valign="top"><div align="center"> 
                        <input name="length" type="text" size="5">
                      </div></td>
    
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>---Connector 
                        3--- </strong></font></div></td>
                  </tr>
                  <tr bgcolor="#999966"> 
                    <td height="26">&nbsp;</td>
                    <td>&nbsp;</td>
                    <td height="26"><div align="center"></div></td>
                    <td><div align="center"> 
                        <select name="con3">
                          <option value="0.00" selected>Male XLR</option>
    
                          <option value="0.00">Female XLR</option>
                          <option value="0.00">Stereo Jack (TRS)</option>
                          <option value="0.00">Mono Jack</option>
                          <option value="0.00">Phono (RCA)</option>
                          <option value="0.00">Minijack</option>
                        </select>
    
                      </div></td>
                  </tr>
                  <tr bgcolor="#999966"> 
                    <td height="21">&nbsp;</td>
                    <td>&nbsp;</td>
                    <td valign="bottom"><div align="center"><strong><font color="#CCCCCC" face="Verdana, Arial, Helvetica, sans-serif">Total 
                        &euro; </font></strong></div></td>
                    <td> <div align="center"></div></td>
                  </tr>
    
                  <tr bgcolor="#999966"> 
                    <td height="26">&nbsp;</td>
                    <td> <div align="center"> 
                        <input type="button" value="Calculate" onClick="doMath('Yleads')" name="button">
                      </div></td>
                    <td> <div align="center"> 
                        <input name="amount" type="text" size="10">
                      </div></td>
                    <td>&nbsp;</td>
    
                  </tr>
                </table>
                      </div></td>
                  </tr>
                </table>
          </FORM>
    	  
    	  <FORM NAME="4 Pair">
        <table width="75%" border="0">
                  <tr>
    
                    <td><div align="center"><font color="#999999" size="5" face="Geneva, Arial, Helvetica, sans-serif">4 
                Pair Multicores</font></div></td>
                  </tr>
                </table>
                <table width="60%" border="1" bgcolor="#333333">
                  <tr>
                    <td height="114"><div align="center">
                        
                <table width="673" height="110" border="0" cellspacing="0">
                  <tr bgcolor="#999966"> 
                    <td height="18" valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>--Connector 
                        1 (X4)-- </strong></font></div></td>
    
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>--Cable 
                        Type--</strong></font></div></td>
                    <td valign="bottom"><p align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>Lenght/Meter</strong></font></p></td>
                    <td valign="bottom"><div align="center"><font color="#000000" size="3" face="Times New Roman, Times, serif"><strong>--Connector 
                        2 (X4)--</strong></font></div></td>
                  </tr>
                  <tr valign="top" bgcolor="#999966"> 
                    <td height="35"> <div align="center"> 
                        <select name="con1">
                          <option value="0.00" selected>Male XLR</option>
    
                          <option value="0.00">Female XLR</option>
                          <option value="0.00">Stereo Jack (TRS)</option>
                          <option value="0.00">Mono Jack</option>
                          <option value="0.00">Phono (RCA)</option>
                          <option value="0.00">Minijack</option>
                        </select>
    
                      </div></td>
                    <td><div align="center"> 
                        <select name="cable">
                          <option value="0.00">4 Pair Multi</option>
                        </select>
                      </div></td>
                    <td><div align="center"> 
                        <input name="length" type="text" size="5">
                      </div></td>
    
                    <td><div align="center"> 
                        <select name="con2">
                          <option value="0.00" selected>Male XLR</option>
                          <option value="0.00">Female XLR</option>
                          <option value="0.00">Stereo Jack (TRS)</option>
                          <option value="0.00">Mono Jack</option>
                          <option value="0.00">Phono (RCA)</option>
    
                          <option value="0.00">Minijack</option>
                        </select>
                      </div></td>
                  </tr>
                  <tr bgcolor="#999966"> 
                    <td height="21">&nbsp; </td>
                    <td>&nbsp;</td>
                    <td valign="bottom"><div align="center"><strong><font color="#CCCCCC" face="Verdana, Arial, Helvetica, sans-serif">Total 
                        &euro; </font></strong></div></td>
    
                    <td>&nbsp;</td>
                  </tr>
                  <tr bgcolor="#999966"> 
                    <td height="26">&nbsp;</td>
                    <td> <div align="center"> 
                        <input type="button" value="Calculate" onClick="doMath('4 Pair')" name="button">
                      </div></td>
                    <td><div align="center"> 
                        <input name="amount" type="text" size="10">
                      </div></td>
    
                    <td>&nbsp;</td>
                  </tr>
                </table>
                      </div></td>
                  </tr>
                </table>
          </FORM>
        
          </CENTER>
    
    </body>
    </html>
    david_kw

  • #8
    New Coder
    Join Date
    Dec 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    Sorry for late reply but I got swamped by work for the past few days. That code worked like a charm. Many thanks again for ALL the help..

    Anto

  • #9
    New Coder
    Join Date
    Dec 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi David,

    It's just been pointed out to me that I never refer to people be there names on here. Sorry about that, and thanks again for all the help. You've been very generous with your time and skill.

    Have a good Xmas and all the best for '07

    Anto

  • #10
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There is no apology necessary to me since it never bothered me. I only hope your new website makes your job just that much easier. And you have great holidays as well.

    david_kw


  •  

    Posting Permissions

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