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

Using value from HTML page in java script function

P: 79
Hi I have a combo box having the values of year.
[HTML]<select name=year value=2008>
<option value=2007>2007</option>
<option value=2007>2006</option>
<option value=2007>2005</option>
</select>&
[/HTML]I want to use this value of year in my java script function
Expand|Select|Wrap|Line Numbers
  1. function veiw()
  2. {
  3.  
  4. //java script code
  5. }
  6. </script>
  7.  
How can i use this value in the function...
i tried using document.year.value but its not working...
Feb 25 '08 #1
Share this Question
Share on Google+
2 Replies


acoder
Expert Mod 15k+
P: 16,027
Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [code] tags in future. Thanks!
Feb 25 '08 #2

acoder
Expert Mod 15k+
P: 16,027
Expand|Select|Wrap|Line Numbers
  1. document.forms[NameOfForm].elements["year"].value
where NameOfForm is the name of the form.
Feb 25 '08 #3

Post your reply

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