This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes How to add year in select Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply locked New topic
Author

How to add year in select

Vaishali Paramane
Ranch Hand

Joined: Mar 05, 2007
Posts: 107
Hi this is my first program in javascript.

I want to add year dynamically in select option. I wrote following code but it is not working.
Register.html



SCJP, SCJD
Preparing for SCWCD
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 543
Hello,
document.Register.year.options[selectLength] = newOpt;


There is no form named "Register".

Regards,
Amit
Goutam Chowdhury
Ranch Hand

Joined: Jan 20, 2009
Posts: 44


Thanks And Regards
Goutam Chowdhury (Scjp1.4 86%,SCWCD5 94%)
Vaishali Paramane
Ranch Hand

Joined: Mar 05, 2007
Posts: 107
Thanks

This is working but only it adds 1900 one number.

document.Register.year.options[selectLength ] = newOpt;
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15385
    
    6
because selectLenght is never updated with the new length.
Vaishali Paramane
Ranch Hand

Joined: Mar 05, 2007
Posts: 107
Thanks

Now it is working
Vaishali Paramane
Ranch Hand

Joined: Mar 05, 2007
Posts: 107
Now I am having problem when I am using tag library


How to use name attribute to work javascript code?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63349
    
  70

Please ask new question in new topics.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to add year in select
 
It's not a secret anymore!