473,378 Members | 1,383 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,378 software developers and data experts.

Easy question about a drop down

I'm trying to get the value from the selected option in a drop down and multiply it by another. The values of this particular drop down are numbers, but I keep getting NaN. Here's the script I'm trying to use:

function calcTotal5(){
var seating = document.FrontPage_Form1.price.value;
var subscriptions = document.FrontPage_Form1.number.value; // problem is here
var calculate = seating * subscriptions;
document.FrontPage_Form1.TOTAL.value = calculate;
}

I'm much more at home with PHP, but have to use javascript for this. The problematic line is the one I commented on. If I comment that entire line out and where the multiply is, replace subscriptions with an integer, it works fine. I'm just not grabbing the value from the drop down 'number' correctly. When I get the value of subscriptions, it's 'undefined'.

Any help would be appreciated, thank you
May 23 '07 #1
2 960
I also tried this:
var subscriptions = document.FrontPage_Form1.number.options[document.FrontPage_Form1.number.selectedIndex].value;
May 23 '07 #2
I found the problem just now.
I changed the name of the drop down from 'number' to 'subscriptionNumber' and now it works. I guess it was because number is a reserved js name, but I wasn't getting any errors regarding that.
May 23 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: PT | last post by:
I got a form with many text boxes, checkboxes and 3 drop downs. From that 3, 2 are dependant. I can choose one drop down, and the next drop down should display the dependant values of the first...
2
by: ehm | last post by:
I am working on creating an editable grid (for use in adding, deleting, and editing rows back to an Oracle database). I have a JSP that posts back to a servlet, which in turns posts to a WebLogic...
8
by: Adam Clauss | last post by:
I have a folder containing many subfolders (and subfolders and....) all containing various .cs files. Is there any "easy" way to get them all added to the solution. Preferable would be that the...
2
by: Yoshitha | last post by:
hi I have 2 drop down lists in my application.1st list ontains itmes like java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100. i will...
8
by: rodchar | last post by:
hey all, i was wondering if this was worth doing or what implications might be. if i had a form that has 6 or more table lookups inside drop down lists would 6 custom controls be a lot of...
7
by: callawayglfr | last post by:
I am building a database in access where I have a drop down box that relates to a text box, that part I have working but when someone selects information from the first drop down I need it to limit...
2
by: champ.supernova | last post by:
I have a repeater, which contains in its <HEADERTEMPLATEa drop-down list (set to autopostback). If the page is a postback, I want to modify the SQL of the repeater's datasource, DEPENDING ON the...
4
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me...
3
by: penny111 | last post by:
Hi there, For my application, i need to have 3 drop down lists 1. drop down list of folder names 2. drop down list of documents in the folder selected 3. drop down list of instances of the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.