Need a dropdown list that holds the value

Y

Yonih

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">Overnight - $24.00</option>
</select><br>

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

Thank you in Advanced
 
V

VK

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">Overnight - $24.00</option>
          </select><br>

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

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>Demo</title>
</head>
<body>
<form action="">
<fieldset>
<legend>Shipping</legend>
<select name="shippingOptions" onchange="
this.form.shippingType.value = this.options[this.selectedIndex].text;
this.form.shippingPrice.value =
this.options[this.selectedIndex].value;
">
<option value="8.50" selected>Ground</option>
<option value="10.50">3-Day</option>
<option value="14.50">2-Day</option>
<option value="24.00">Overnight</option>
</select>
<br>
<input type="text" value="" name="shippingType">
<input type="text" value="" name="shippingPrice">
</fieldset>
</form>
</body>
</html>
 
Y

Yonih

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.

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">Overnight - $24.00</option>
          </select><br>
<!-- Display Below -->
<input type="text" value=""  name="shipping"> Has been Selected

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type"
 content="text/html; charset=iso-8859-1">
<title>Demo</title>
</head>
<body>
<form action="">
 <fieldset>
  <legend>Shipping</legend>
   <select name="shippingOptions" onchange="
 this.form.shippingType.value = this.options[this.selectedIndex].text;
 this.form.shippingPrice.value =
this.options[this.selectedIndex].value;
    ">
    <option value="8.50" selected>Ground</option>
    <option value="10.50">3-Day</option>
    <option value="14.50">2-Day</option>
    <option value="24.00">Overnight</option>
   </select>
   <br>
   <input type="text" value=""  name="shippingType">
   <input type="text" value=""  name="shippingPrice">
 </fieldset>
</form>
</body>
</html>- Hide quoted text -

- Show quoted text -

Thank you so much, Ive been going crazy trying to get something to
work.

Your Awesome

Thanks

Yoni
 
Y

Yonih

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"> Price of Item
<br>

<select name="shippingOptions" onchange="this.form.shippingPrice.value
= this.options[this.selectedIndex].value; ">
<option value="8.50">Ground - $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">Overnight - $24.00</option></select>
<input type="text" value="" name="shippingPrice">

<br>
<br><br>
<input type="button" value="Convert" onclick="javascript:calc()">
<input type="reset" value="reset" onclick="javascript:calc()">
<br><br>
<input type="text" value="" name="downpayment"> 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"> Total Amount Paid

</form>

<script language="javascript">

//calculate function
function calc(){

//variables
var price = document.converter.price.value
var downpaymentdisplay = Math.round(price * .60)
var payment2display = Math.round(price * .10)
var payment3display = Math.round(price * .10)
var payment4display = Math.round(price * .10)
var payment5display = Math.round(price * .10)

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

//write in text box
document.converter.downpayment.value=downpaymentdisplay
document.converter.payment2.value=payment2display
document.converter.payment3.value=payment3display
document.converter.payment4.value=payment4display
document.converter.payment5.value=payment5display
document.converter.total.value=totaldisplay

}
</script>
</body>
 
S

SAM

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.selectedIndex;
if(k==0) alert('choose another item');
else shipping.value=this.options[k].value;">
 
S

SAM

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="shippingOptions"
onchange="var k = this.selectedIndex;
var fee = this.options[k].value;
shippingPrice.value = fee;
downpayment.value = +downpayment.value+fee;
calc(); ">

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

<select name="shippingOptions" onchange="this.form.shippingPrice.value
= this.options[this.selectedIndex].value; ">
<option value="8.50">Ground - $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">Overnight - $24.00</option></select>
<input type="text" value="" name="shippingPrice">

<br>
<br><br>
<input type="button" value="Convert" onclick="javascript:calc()">
<input type="reset" value="reset" onclick="javascript:calc()">
<br><br>
<input type="text" value="" name="downpayment"> 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"> Total Amount Paid

</form>

<script language="javascript">

//calculate function
function calc(){

//variables
var price = document.converter.price.value
var downpaymentdisplay = Math.round(price * .60)
var payment2display = Math.round(price * .10)
var payment3display = Math.round(price * .10)
var payment4display = Math.round(price * .10)
var payment5display = Math.round(price * .10)

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

//write in text box
document.converter.downpayment.value=downpaymentdisplay
document.converter.payment2.value=payment2display
document.converter.payment3.value=payment3display
document.converter.payment4.value=payment4display
document.converter.payment5.value=payment5display
document.converter.total.value=totaldisplay

}
</script>
</body>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top