SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member
    Join Date
    Mar 2002
    Location
    Lagos, Nigeria
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face I need to show current dd/mm/yy in my pulldown menu

    Hi guys pls I need a javascript that will show me the select the current date in my pulldown menu. the menu will consist of days, months and years. Anyone pls,anyone

  2. #2
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <select>
    <option>
    <script type="text/javascript">
    document.write(d.getDate(), '/', d.getMonth() + 1,'/', d.getFullYear())
    <script>
    </option>
    </select>

    thats it

  3. #3
    SitePoint Member
    Join Date
    Mar 2002
    Location
    Lagos, Nigeria
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how do i integrate this into my select tag. for instance i have this already
    <select class="body2" name="date_month" size="1">

    <option value="" selected>Month</option>
    <option value="January">January</option>
    <option value="Februrary">Februrary</option>
    <option value="March">March</option>
    <option>
    </select>
    i want it to default to may when i load my page thanks

  4. #4
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thats it, have fun

    PHP Code:
    <script type="text/javascript">

    var 
    = new Date()
    var 
    dateM = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

      
    '<select>';

        for (
    a=0,b=12;a<b;a++)
        {
          if (
    d.getMonth()==ax+= '<option style="background-color: orange" selected>' dateM[a] + '</option>';
          else                 
    x+= '<option>' dateM[a] + '</option>';
        }

      
    x+='</select>';

    document.write(x);

    </script> 

  5. #5
    SitePoint Member
    Join Date
    Mar 2002
    Location
    Lagos, Nigeria
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    did i forget to say thanks!

  6. #6
    SitePoint Member
    Join Date
    Mar 2002
    Location
    Lagos, Nigeria
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    opps date means year and day too. pushing my luck eh!

  7. #7
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yea boss, you bloody are hehe

    but what do you want as the date tho? do you want it so theres 3 dropdowns or hava a fixed date in one drop down ?

    PHP Code:
    <script type="text/javascript">

      var 
    = new Date()
      var 
    dateM = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
      var 
    datet = new Array('<sup>st<sup>','<sup>nd<sup>','<sup>rd<sup>','<sup>th<sup>');
      var 
    part;

      if      (
    d.getDate() == || d.getDate() == 21 || d.getDate() == 31part datet[0];
      else if (
    d.getDate() == || d.getDate() == 22 || d.getDate() == 32part datet[1];
      else if (
    d.getDate() == || d.getDate() == 23 || d.getDate() == 33part datet[2];
      else 
    part datet[3];


      
    '<select>';

        for (
    a=0,b=12;a<b;a++)
        {
          if (
    d.getMonth()==ax+= '<option style="background-color:orange" selected>' d.getDate() + part ' ' dateM[a] + ' ' d.getFullYear() + '</option>';
          else                 
    x+= '<option>' dateM[a] + ' ' d.getFullYear() + '</option>';
        }

      
    x+='</select>';

    document.write(x);

    </script> 

  8. #8
    SitePoint Member
    Join Date
    Mar 2002
    Location
    Lagos, Nigeria
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh boy, i'm getting lazy already!!! 3 drop downs, where each one shows me the current dd/mm/yyyy , but if my event is not the current date, then i can manually change it, by dropping down and choosing what i want. then with my php it displays the event and the date on another page. I guess we are on track

  9. #9
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sry i dont have time to do that now as i need to pack my case so i can move from singapore to live in London. Maybe someone else can help with this?

  10. #10
    SitePoint Member
    Join Date
    Mar 2002
    Location
    Lagos, Nigeria
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i know you are a genius of some sort,thanks a lot for all anyway, take a sneek view at my site, www.checkuremail.com;)


Bookmarks

Posting Permissions

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