473,395 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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">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
3 1728
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Joseph Barron | last post by:
Here is a SIMPLE problem that I'm trying to solve. It works in Netscape 6.2, but IE6 gives ""No such interface supported." Below are page1.htm and page2.htm . In page1.htm, there are two...
0
by: Toonman | last post by:
I have a webpage with a <form> consisting of a large table grid of dropdown lists used to make changes in a database. Some of these dropdown lists have the same value. I'm trying to make it so...
5
by: Kris Rockwell | last post by:
Hello (again), I have gotten the dropdown list functionality to work through a few tricks (probably not the most efficient, but it works) but I am not sure how to set the default selected value....
4
by: Paul | last post by:
I have a dropdown list box and a button on a web form, the autopost back is false for the dropdown list box and button. When the button is pushed the selection in the dropdownlist box is lost,...
1
by: JNariss | last post by:
Hello, I have created a form called frmS2P with the following: 1 listbox called List11 which holds the contents of a query created off my table called tblRequestActions. The fields which the...
3
by: er1 | last post by:
Hi all, I have created a double dropdown list. Based on the first list selection, second list populates (this works fine). I have a submit button, which when clicked should run a select query...
6
by: yasodhai | last post by:
Hi, I used a dropdown control which is binded to a datagrid control. I passed the values to the dropdownlist from the database using a function as follows in the aspx itself. <asp:DropDownList...
6
by: Cralis | last post by:
Hi guys, Someone once said, 'You can do that with reflection'. I can't recall what it was I was trying to do at the time, but then he said, 'Any developer knows what reflection is...'. I kept...
5
by: plumba | last post by:
Hi all. I have two drop down menus, the first a list of Departments, the second a list of Sections. Each Department has a set of Setions, so the Sections dropdown contains complete list of all...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.