Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,096
    Thanks
    15
    Thanked 1 Time in 1 Post

    change drop-down menu values

    I have this text box:

    Code:
    <input type="text" name="test2" id="test2">

    With the value that is inserted into this textbox I want to change the values of two drop-down menus:

    The first one is for the DAY:


    Code:
    <Select style="height: 20; font-size : 10;" Name="depDay" onchange="javascript: sortMn('OUT')">
            <% 
            dy = (DatePart("d", date()) + 7)
    '        response.Write "dy="&dy&"<br>"
                  nxtMn = False
                  if dy > 31 then
                       dy = (dy - 31)
                         nxtMn = True
                  end if        
            for i=1 to 31 
            %>
            <% if i=dy then %>
            <option value="<%=i%>" SELECTED><%=i%></option>
            <% else %>
            <option value="<%=i%>"><%=i%></option>
            <% end if 
            next %>
         </Select>

    the second one is for the MONTH:

    Code:
    <Select style="width: 110; height: 20; font-size : 10;" Name="depMonth" onchange="javascript: sortMn('OUT')">
            <% 
            mnNow = Month(Now)
            yr = Year(Now)    
                  nxtYr = left(yr, 2) & "0" & (right(yr, 2) + 1)                            
                    if nxtMn then
                         mnNow = (mnNow + 1)
                    end if                    
            for i=mnNow to (mnNow + 11)
                    ic = i
                    nextYr = False
            if i > 12 then
                         ic = (i - 12) 
                         nextYr = True
                    end if
                    mn = MonthName(ic)                  
            %>
            <% if i=mnNow then %>
            <option value="<%=yr & "#" & ic%>" SELECTED><%=mn & " " & yr%></option>
            <% else %>                         
            <option value="<% if nextYr then response.write nxtYr else response.write yr %>#<%=ic%>">
                    <%=mn & " "%><% if nextYr then response.write nxtYr else response.write yr %></option>
            <% end if 
            next %>
         </Select>

  • #2
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,096
    Thanks
    15
    Thanked 1 Time in 1 Post
    the value of the text box is in format: MM/DD/YYYY

    The two drop-dopwn menus are day and month

  • #3
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,096
    Thanks
    15
    Thanked 1 Time in 1 Post
    is there a way i can cut the value up and match it against the values in the drop down menus?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •