Need a dropdown list that holds the value

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Yonih

    Need a dropdown list that holds the value

    Hey Everyone,

    I was hoping someone could help me here. I need a way to have a drop
    down that when selected it can keep a value and display it below here
    is an example.
    A drop down list of different shipping methods.

    Ground
    3day
    2day

    then a price on the back end associated with each of them
    ground = 8
    3day = 10
    2day = 14

    then finally a box under it to display what was chosen so if Ground
    was chosen the box below it will show 8

    Can anyone help me with this. I can attach what Ive started but as you
    can see have now clue what im doing. and its prob all wrong but at
    least you might get a understanding.


    <select name="selectbox " value="shipping " size="1">
    <option name="ground" value="8.50" >Ground - $8.50</
    option>
    <option name="3day" value="10.50" >3-Day - $10.50</option>
    <option name="2day" value="14.50">2-Day - $14.50</option>
    <option name="overnight " value="24.00">O vernight - $24.00</option>
    </select><br>

    <!-- Display Below -->
    <input type="text" value="" name="shipping" Has been Selected

    Thank you in Advanced
  • Yonih

    #2
    Re: Need a dropdown list that holds the value

    Hey so THank you so much for the script however I was hoping I would
    be able to incorperate it into my original script but seems to not be
    working. Here is the script Im sure there isnt much left todo but
    still if soemone can help.

    I just need when they select the shipping methiod it gets added to the
    total amount and also to the downpayment as (+ downpayment)

    THank you

    Yoni

    <body>
    <form name="converter ">
    <input type="text" value="0.00" name="price"Pri ce of Item
    <br>

    <select name="shippingO ptions" onchange="this. form.shippingPr ice.value
    = this.options[this.selectedIn dex].value; ">
    <option value="8.50">Gr ound - $8.50</option>
    <option value="10.50">3-Day - $10.50</option>
    <option value="14.50">2-Day - $14.50</option>
    <option value="24.00">O vernight - $24.00</option></select>
    <input type="text" value="" name="shippingP rice">

    <br>
    <br><br>
    <input type="button" value="Convert" onclick="javasc ript:calc()">
    <input type="reset" value="reset" onclick="javasc ript:calc()">
    <br><br>
    <input type="text" value="" name="downpayme nt"Down Payment
    <br>
    <input type="text" value="" name="payment2" Payment 2
    <br>
    <input type="text" value="" name="payment3" Payment 3
    <br>
    <input type="text" value="" name="payment4" Payment 4
    <br>
    <input type="text" value="" name="payment5" Payment 5
    <br>
    <br>
    <input type="text" value="" name="total"Tot al Amount Paid

    </form>

    <script language="javas cript">

    //calculate function
    function calc(){

    //variables
    var price = document.conver ter.price.value
    var downpaymentdisp lay = Math.round(pric e * .60)
    var payment2display = Math.round(pric e * .10)
    var payment3display = Math.round(pric e * .10)
    var payment4display = Math.round(pric e * .10)
    var payment5display = Math.round(pric e * .10)

    var totaldisplay = Math.round(down paymentdisplay + payment2display +
    payment3display + payment4display + payment5display )

    //write in text box
    document.conver ter.downpayment .value=downpaym entdisplay
    document.conver ter.payment2.va lue=payment2dis play
    document.conver ter.payment3.va lue=payment3dis play
    document.conver ter.payment4.va lue=payment4dis play
    document.conver ter.payment5.va lue=payment5dis play
    document.conver ter.total.value =totaldisplay

    }
    </script>
    </body>

    Comment

    • SAM

      #3
      Re: Need a dropdown list that holds the value

      Yonih a écrit :
      Hey Everyone,
      >
      I was hoping someone could help me here. I need a way to have a drop
      down that when selected it can keep a value and display it below here
      is an example.
      A drop down list of different shipping methods.
      <select name="selectbox " value="shipping " size="1"
      onchange="var k=this.selected Index;
      if(k==0) alert('choose another item');
      else shipping.value= this.options[k].value;">

      <option selected>Fee</otpion>
      <option name="ground" value="8.50" >Ground - $8.50</option>
      <option name="3day" value="10.50" >3-Day - $10.50</option>
      <option name="2day" value="14.50">2-Day - $14.50</option>
      <option name="overnight " value="24.00">O vernight - $24.00</option>
      </select><br>
      >
      <!-- Display Below -->
      <input type="text" value="" name="shipping" Has been Selected

      --
      sm

      Comment

      • SAM

        #4
        Re: Need a dropdown list that holds the value

        Yonih a écrit :
        Hey so THank you so much for the script however I was hoping I would
        be able to incorperate it into my original script but seems to not be
        working. Here is the script Im sure there isnt much left todo but
        still if soemone can help.
        >
        I just need when they select the shipping methiod it gets added to the
        total amount and also to the downpayment as (+ downpayment)
        <select name="shippingO ptions"
        onchange="var k = this.selectedIn dex;
        var fee = this.options[k].value;
        shippingPrice.v alue = fee;
        downpayment.val ue = +downpayment.va lue+fee;
        calc(); ">

        <form name="converter ">
        <input type="text" value="0.00" name="price"Pri ce of Item
        <br>
        >
        <select name="shippingO ptions" onchange="this. form.shippingPr ice.value
        = this.options[this.selectedIn dex].value; ">
        <option value="8.50">Gr ound - $8.50</option>
        <option value="10.50">3-Day - $10.50</option>
        <option value="14.50">2-Day - $14.50</option>
        <option value="24.00">O vernight - $24.00</option></select>
        <input type="text" value="" name="shippingP rice">
        >
        <br>
        <br><br>
        <input type="button" value="Convert" onclick="javasc ript:calc()">
        <input type="reset" value="reset" onclick="javasc ript:calc()">
        <br><br>
        <input type="text" value="" name="downpayme nt"Down Payment
        <br>
        <input type="text" value="" name="payment2" Payment 2
        <br>
        <input type="text" value="" name="payment3" Payment 3
        <br>
        <input type="text" value="" name="payment4" Payment 4
        <br>
        <input type="text" value="" name="payment5" Payment 5
        <br>
        <br>
        <input type="text" value="" name="total"Tot al Amount Paid
        >
        </form>
        >
        <script language="javas cript">
        >
        //calculate function
        function calc(){
        >
        //variables
        var price = document.conver ter.price.value
        var downpaymentdisp lay = Math.round(pric e * .60)
        var payment2display = Math.round(pric e * .10)
        var payment3display = Math.round(pric e * .10)
        var payment4display = Math.round(pric e * .10)
        var payment5display = Math.round(pric e * .10)
        >
        var totaldisplay = Math.round(down paymentdisplay + payment2display +
        payment3display + payment4display + payment5display )
        >
        //write in text box
        document.conver ter.downpayment .value=downpaym entdisplay
        document.conver ter.payment2.va lue=payment2dis play
        document.conver ter.payment3.va lue=payment3dis play
        document.conver ter.payment4.va lue=payment4dis play
        document.conver ter.payment5.va lue=payment5dis play
        document.conver ter.total.value =totaldisplay
        >
        }
        </script>
        </body>

        Comment

        Working...