Results 1 to 3 of 3

Thread: Loading JS file in day of the month

  1. #1
    Join Date
    Jul 2005
    Location
    Oregon, USA
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Loading JS file in day of the month

    Please help me. I want to load js file in html.
    For example, today in the Feb 6, 2006.
    I want the script load the file 6.js

    <HTML><HEAD><TITLE>LOADING JS</TITLE>
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    var today = new Date();
    var day = today.getDate();
    // End -->
    </SCRIPT>
    </HEAD>
    <BODY>
    <SCRIPT type="text/javascript">
    document.write('<SCRIPT src="'+day+'.js" type="text/javascript"></SCRIPT>');
    </SCRIPT>
    </BODY>
    </HTML>

    THANK YOU

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You need to at least escape the closing script tag:

    Code:
    document.write('<script src="'+day+'.js" type="text/javascript"><\/script>');
    You may have to break it up as well:

    Code:
    document.write('<script src="'+day+'.js" type="text/javascript"><\/'+'script>');
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2005
    Location
    Oregon, USA
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thanks John!

    It's work now :-)

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
  •