By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,044 Members | 1,192 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,044 IT Pros & Developers. It's quick & easy.

Need a dropdown list that holds the value

P: n/a
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
Jun 27 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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=downpaymentdi splay
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>
Jun 27 '08 #2

P: n/a
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;">

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

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

--
sm
Jun 27 '08 #3

P: n/a
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=downpaymentdi splay
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>
Jun 27 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.