Note that there are some explanatory texts on larger screens.

plurals
  1. POSelect tag / option tag trouble
    primarykey
    data
    text
    <p>So after about an hour wasn't able to find a good tutorial on how to use these tags and their ids,names, and values to achieve a decimal amount to finish summing my form. Simply put I have a select box and wish for it to return my option value and the amount of that option value.</p> <p>Heres the HTML</p> <pre><code>&lt;tr&gt; &lt;th colspan="4" class="label"&gt;Shipping Method: &lt;select name="shipMethod" id="shipMethod" size="1"&gt; &lt;option value=""&gt;Choose a shipping method&lt;/option&gt; &lt;option value="priority2"&gt;Priority mail $3.20 (4 items or less)&lt;/option&gt; &lt;option value="priority3"&gt;Priority mail $4.30 (6 items or less)&lt;/option&gt; &lt;option value="priority4"&gt;Priority mail $5.40 (8 items or less)&lt;/option&gt; &lt;option value="overnight"&gt;Express $15.75 (4 items or less only)&lt;/option&gt; &lt;option value="UPS"&gt;UPS - 2 day $15.00 (9 - 49 items)&lt;/option&gt; &lt;option value="free"&gt;Free shipping (50+ items only)&lt;/option&gt; &lt;/select&gt; &lt;/th&gt; &lt;td&gt;&lt;input name="shippingChg" id="shippingChg" type="text" size="10" maxlength="60" value="" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; </code></pre> <p>Probably my first problem is setting up a loop for the decimal side of things. This is how I would attempt to write my loop and function for one select box</p> <pre><code> function ship_some_stuff() var ship_me= document.getElementById("shipMethod").value; (unsure if this returns the option value though, but the idea is to save to a variable later) if ship_me == priority2 { var shipthisway = 3.20; document.getElementById("shippingCHg").value = varshipthisway ; } if ship_me == priority3{ var shipthisway = 4.30; document.getElementById("shippingCHg").value = varshipthisway ; } else varship == ""; { alert("You haven't selected a shipping Method"); } </code></pre> <p>Thanks for the help!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload