using createElement with VBScript

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
 
R

Ray at

Try posting to a client-side group such as
microsoft.public.scripting.vbscript. This group is about server-side
scripting.

Ray at home
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top