You need to put a space in front of the word selected. Right now your HTML
output will contain:
2005
This makes the value equal to 2005selected. By putting a space in between
the quote and the word selected - you will change the value to 2005 and
selected will be picked up correctly.
document.write('' + i + '');
You should put double quotes around the value parameter - its cleaner HTML:
document.write('' + i + '');
You might have to escape those - I'm not sure.
-Original Message-
From: Jacob Wilson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 04, 2003 5:00 PM
To: Struts Users Mailing List
Subject: RE: Javascript question...
Richard...
I find this list to be more user friendly in terms of responding to
questions... Also, not that I do not use Struts at all... for this
particular requirement of an old project under maintenance, I am trying to
do this... I consider this to be very much knowledge sharing list and hence
post questions whenever I have any... thanks is advance...
Now, getting back to your question... this is the code...
function generateYear(optionName,defaultValue) {
var today = new Date();
var year = today.getYear();
document.write('');
}