File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 106
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: 507
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: 106
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: 15376
    
    6
because selectLenght is never updated with the new length.
Vaishali Paramane
Ranch Hand

Joined: Mar 05, 2007
Posts: 106
Thanks

Now it is working
Vaishali Paramane
Ranch Hand

Joined: Mar 05, 2007
Posts: 106
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: 60059
    
  65

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
 
Similar Threads
using tld form name attribute problem
Options in drop-down menu
displaying year through listbox
Update select list from a callee page
dynamically adding options to select box