using createElement with VBScript

Discussion in 'ASP General' started by Jeremy, Jul 23, 2003.

  1. Jeremy

    Jeremy Guest

    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
    Jeremy, Jul 23, 2003
    #1
    1. Advertising

  2. Jeremy

    Ray at Guest

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

    Ray at home

    --
    Will trade ASP help for SQL Server help


    "Jeremy" <> wrote in message
    news:...
    > Hi, I am trying to create dynamic list boxes using the onChange event
    > handler.
    Ray at, Jul 23, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arpan

    DOM CreateElement?

    Arpan, Aug 23, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    468
    Martin Honnen
    Aug 25, 2006
  2. kie
    Replies:
    25
    Views:
    244
  3. James Black
    Replies:
    10
    Views:
    276
    Thomas 'PointedEars' Lahn
    May 25, 2006
  4. Replies:
    2
    Views:
    129
  5. Replies:
    5
    Views:
    95
Loading...

Share This Page