469,330 Members | 1,212 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,330 developers. It's quick & easy.

Using value from HTML page in java script function

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>
[/HTML]I want to use this value of year in my java script function
Expand|Select|Wrap|Line Numbers
  1. function veiw()
  2. {
  4. //java script code
  5. }
  6. </script>
How can i use this value in the function...
i tried using document.year.value but its not working...
Feb 25 '08 #1
2 1098
16,027 Expert Mod 8TB
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
16,027 Expert Mod 8TB
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.

By using this site, you agree to our Privacy Policy and Terms of Use.