Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: need codin advice  (Read 44959 times)

0 Members and 1 Guest are viewing this topic.

charlzguitarz

    Topic Starter


    Greenhorn

    • Experience: Experienced
    • OS: Windows 7
    need codin advice
    « on: September 05, 2019, 08:04:53 PM »
    <!-- ---------------------------------------- A -------------------------------------------------- -->
    Each item in section B has two necks, either 6 & 12 string, 6 string & bass or 12 string & bass & exclude flat/nylon wound [added charge]. The flat/nylon wound [added charge] for 6 OR 12 string = 17.95. The flat/nylon wound [added charge] for bass string = 37.95. At a loss how to show these options in section B
    <!-- -----------------------------------------------------------------------------------------  -->
    <table>
      <tr>
        <th><input type="text" size="20" maxlength="30" name="unit-price" value="Product - Unit Price" STYLE="color: #000000; font-weight: bold; background-color: #ccffff;"></th>
        <th><input type="text" size="5" maxlength="30" name="order-qty" value="Qty" STYLE="color: #000000; font-weight: bold; background-color: #ccffff;" ></th>
        <th><input type="text" size="15" maxlength="30" name="item-total" value="Purchase total" STYLE="color: #000000; font-weight: bold; background-color: #ccffff;" ></th>
    <!-- ------------------------------------------ B ---------------------------------------------- -->
    <tr>
    <td align="middle"><select name="unitprice1" onchange="calculate(1)">
    <OPTION value=""></OPTION>
    <OPTION value="259.95" style="background-color: pink;">Duoblus Conversion - 259.95</OPTION>
    <OPTION value="299.95" style="background-color: violet;">Melodius Conversion  - 299.95</OPTION>
    <OPTION value="327.95" style="background-color: pink;">MelodiusII Conversion - 327.95</OPTION>
    <OPTION value="573.95" style="background-color: violet;">Hawaiio Conversion  - 573.95</OPTION>
    <OPTION value=""></OPTION>
    <OPTION value="457.95" style="background-color: pink;">New Duoblus - 457.95</OPTION>
    <OPTION value="527.95" style="background-color: violet;">New Melodius - 527.95</OPTION>
    <OPTION value="555.95" style="background-color: pink;">NEW MelodiusII - 555.95</OPTION>
    <OPTION value="757.95" style="background-color: violet;">New Hawaiio - 757.95</OPTION>
    </select></td>

        <td align="middle"><select name="qty1" onchange="calculate(1)">
    <OPTION value="" selected>choose</option>
    <OPTION value="1">1</option>
    <OPTION value="2">2</option>
          </select></td>
         <td align="middle">$<input type="text" class="result" name="result1"></td>
      </tr></table><BR>
    <!-- ------------------------------------------------------------------  -->
    <script>
        function calculate(n) {
            var p = document.getElementsByName('unitprice'+n)[0].value,
                q = document.getElementsByName('qty'+n)[0].value;
            document.getElementsByName('result'+n)[0].value = (p * q).toFixed(2);
            total(); }

        function total(){ var s1 = document.querySelectorAll('.result'),
                st = form.total.value; st = 0;
            for (var i = 0; i < s1.length; i++)
                { var  a = s1.value,  st = 1*a+1*st; }
            form.total.value = st.toFixed(2);
            form.tax.value = (st * form.taxrate.value).toFixed(2);
            form.total.value = (st*1 + form.tax.value*1).toFixed(2); }
    </script>