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

a select value problem

P: n/a
In the html I have a select option. I am trying to get the result of the
selection(u5503_qty*5) to print after some text. I am having a problem
grabbing the value of u5503_qty from the html to use in the javascript. Can
somebody correct me on this?
Step 4. How many would you like?<br />
<select name="u5503_qty" size="1">
<option label="1" value="1" selected>1</option>
<option label="2" value="2">2</option>
<option label="3" value="3">3</option>
<option label="4" value="4">4</option>
<option label="5" value="5">5</option>
</select>
<br />
At this point, your charges will be....$
<script type= "text/javascript">
var y=5;
document.write(Number(document.value.u5503_qty)*5) ;
</script>
Feb 18 '07 #1
Share this Question
Share on Google+
2 Replies

P: n/a
Thad wrote:
In the html I have a select option. I am trying to get the result of the
selection(u5503_qty*5) to print after some text. I am having a problem
grabbing the value of u5503_qty from the html to use in the javascript. Can
somebody correct me on this?

<select name="u5503_qty" size="1"
onchange='document.getElementById("foo").innerHTML =message(this)'>
<option label="1" value="1" selected>1</option>
<option label="2" value="2">2</option>
<option label="3" value="3">3</option>
<option label="4" value="4">4</option>
<option label="5" value="5">5</option>
</select>
<br />
<p id="foo">Select something</p>
<script type= "text/javascript">
function message(menu){
return "At this point, your charges will be....$"+
menu[menu.selectedIndex].value+".00";
</script>

Why the labels?
Mick
Step 4. How many would you like?<br />
<select name="u5503_qty" size="1">
<option label="1" value="1" selected>1</option>
<option label="2" value="2">2</option>
<option label="3" value="3">3</option>
<option label="4" value="4">4</option>
<option label="5" value="5">5</option>
</select>
<br />
At this point, your charges will be....$
<script type= "text/javascript">
var y=5;
document.write(Number(document.value.u5503_qty)*5) ;
</script>

Feb 18 '07 #2

P: n/a
Why the labels?
Mick
Ignorance...I was thinking that I was needing it. Thank you so much for the
help and pointing out about the labels.

Thad
Feb 18 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.