Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-22-2005, 04:26 PM   PM User | #1
crmpicco
Senior Coder

 
crmpicco's Avatar
 
Join Date: Jan 2005
Location: Mauchline, Scotland
Posts: 1,091
Thanks: 15
Thanked 1 Time in 1 Post
crmpicco has a little shameless behaviour in the past
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>
crmpicco is offline   Reply With Quote
Old 03-22-2005, 05:22 PM   PM User | #2
crmpicco
Senior Coder

 
crmpicco's Avatar
 
Join Date: Jan 2005
Location: Mauchline, Scotland
Posts: 1,091
Thanks: 15
Thanked 1 Time in 1 Post
crmpicco has a little shameless behaviour in the past
the value of the text box is in format: MM/DD/YYYY

The two drop-dopwn menus are day and month
crmpicco is offline   Reply With Quote
Old 03-22-2005, 05:22 PM   PM User | #3
crmpicco
Senior Coder

 
crmpicco's Avatar
 
Join Date: Jan 2005
Location: Mauchline, Scotland
Posts: 1,091
Thanks: 15
Thanked 1 Time in 1 Post
crmpicco has a little shameless behaviour in the past
is there a way i can cut the value up and match it against the values in the drop down menus?
crmpicco is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:26 PM.


Advertisement
Log in to turn off these ads.