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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Trouble making this script

    I'm creating a simple script to redirect a page to a different html page by checking the day of the month. The script looks into the directory with the html pages listed 1 - 31 (i.e. 1.html, 2.html etc). What I want to do is make the javascript seach a particullar directory (menu) to find the html pages. Can any help?

    I have the following directory:
    -Website
    --menu
    ---1.html
    ---2.html

    Here is the script:

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    var today = new Date();
    var day = today.getDate();
    window.location = day + ".html";
    // End -->
    </SCRIPT>

    In this line
    window.location = day + ".html";
    can I change it to
    window.location = day + "/menu/.html";

    Thanks,
    Rob

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    i dont believe that is what u want, that will just look for a file called .html in directories 1-31 with subdirectory of menu, try this
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    <script type="text/javascript">
    <!-- Begin
    var today = new Date();
    var day = today.getDate();
    window.location = "/menu/"+day+".html";
    // End -->
    </script>
    </head>
    
    <body>
    </body>
    </html>
    that will start from the root directory then look in the menu folder and get the corresponding html file that matches the date


  •  

    Posting Permissions

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