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
    New Coder
    Join Date
    Dec 2003
    Location
    UK
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Link changing script

    Is there a script that will change the link according to the day, as in oin Monday, the button would link to one page, on Tuesday, another, and so on throughout the week - if there is, any help would be very much appreciated!

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    São Paulo, Brazil
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Something like this:
    Code:
    <script>
    
    var links=["sunday.html", "monday.html", "tue.html", "wed.html", "thur.html", "fri.html", "sat.html"];
    var now=new Date();
    var link = '<a href="'+links[now.getDay()]+'">link</a>';
    document.write(link);
    
    </script>
    More about Date and getDay() method
    /Daniel

  • #3
    New Coder
    Join Date
    Dec 2003
    Location
    UK
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, works great.


  •  

    Posting Permissions

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