J
Jeremy
Hi, I am trying to create dynamic list boxes using the onChange event
handler.
Basically what I have here is a little function called NumberOfDays
which returns the number of days in a given month in a given year. I
then have an html select box <select> that I am populating with the
number of days returned from the function. Essentially, this
subroutine works. For instance, if I select January of 2003, then it
populate my select box with numbers 1-31 but the problem is if it gets
called a second time, it doens't clear the original data. So if I
select January of 2003, and then I select January of 2002, the select
box will be filled with 1-31,1-31
Here is my subroutine:
Sub end_year_OnChange
days=NumberOfDays(form1.end_month.Value, form1.end_year.Value)
for i=1 to days
Set Opt = document.createElement("OPTION")
Opt.text = i
Opt.value = i
Opt.ID = i
form1.end_day.Add Opt
Set Opt = Nothing
Next
End Sub
handler.
Basically what I have here is a little function called NumberOfDays
which returns the number of days in a given month in a given year. I
then have an html select box <select> that I am populating with the
number of days returned from the function. Essentially, this
subroutine works. For instance, if I select January of 2003, then it
populate my select box with numbers 1-31 but the problem is if it gets
called a second time, it doens't clear the original data. So if I
select January of 2003, and then I select January of 2002, the select
box will be filled with 1-31,1-31
Here is my subroutine:
Sub end_year_OnChange
days=NumberOfDays(form1.end_month.Value, form1.end_year.Value)
for i=1 to days
Set Opt = document.createElement("OPTION")
Opt.text = i
Opt.value = i
Opt.ID = i
form1.end_day.Add Opt
Set Opt = Nothing
Next
End Sub