SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member
    Join Date
    May 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    j-script isnt working with other j-script

    i started using a javascript doc downloaded from this website " http://www.scriptdungeon.com/script.php?ScriptID=1284 " for my background. well it doesnt work in firefox (DOES work in IE) with my date and time script or my counter script. is there anyway they can all live in harmony??

  2. #2
    SitePoint Member
    Join Date
    May 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check the Error console in Firefox, it should give you some clue with what is wrong.

  4. #4
    SitePoint Member
    Join Date
    May 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy

    Ok an error appeared, but it doesnt help me any
    here's the code i have:

    <head>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    var backgroundset=false;
    function fixedBackground(url)
    {
    if(!backgroundset)
    {
    document.body.style.overflow = 'hidden';
    document.body.style.padding = '0px';
    document.body.style.margin = '0px';

    var overlay = document.createElement('DIV');
    overlay.style.position = 'absolute';
    overlay.style.top = '0px';
    overlay.style.left = '0px';
    overlay.style.height = '100&#37;';
    overlay.style.width = '100%';
    overlay.style.overflow = 'auto';

    overlay.innerHTML = document.body.innerHTML;
    document.body.innerHTML = '<img id="background" height="100%" width="100%" src="' + url + '" style="left: 0; bottom: 0; right: 0; top: 0; z-index: 0" />';

    document.body.appendChild(overlay);

    backgroundset=true;
    }
    else
    background.src=url;
    }
    //-->
    </SCRIPT>

    <title>
    TESTING
    </title>
    </head>
    <body onload="fixedBackground('clouds-03.jpg');">
    <div align="center">
    <font size="4">This is the date and timebr><br>
    Date:
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    Stamp = new Date();
    document.write('' + (Stamp.getMonth() + 1) +"/"+Stamp.getDate()+ "/"+Stamp.getYear() + ' <br> ');
    var Hours;
    var Mins;
    var Time;
    Hours = Stamp.getHours();
    if (Hours >= 12) {
    Time = " P.M.";
    }
    else {
    Time = " A.M.";
    }

    if (Hours > 12) {
    Hours -= 12;
    }

    if (Hours == 0) {
    Hours = 12;
    }

    Mins = Stamp.getMinutes();

    if (Mins < 10) {
    Mins = "0" + Mins;
    }

    document.write('<B>Time/b> ' + Hours + ":" + Mins + Time + '');

    //-->
    </SCRIPT>
    </body>

  5. #5
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Note that loading icon never stops spinning. Reason for this is that you use document.write without document.open and then document.close after you finish writing to the document.

  6. #6
    SitePoint Member
    Join Date
    May 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is the part that is messing up - the date and time work fine

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    var backgroundset=false;
    function fixedBackground(url)
    {
    if(!backgroundset)
    {
    document.body.style.overflow = 'hidden';
    document.body.style.padding = '0px';
    document.body.style.margin = '0px';

    var overlay = document.createElement('DIV');
    overlay.style.position = 'absolute';
    overlay.style.top = '0px';
    overlay.style.left = '0px';
    overlay.style.height = '100&#37;';
    overlay.style.width = '100%';
    overlay.style.overflow = 'auto';

    overlay.innerHTML = document.body.innerHTML;
    document.body.innerHTML = '<img id="background" height="100%" width="100%" src="' + url + '" style="left: 0; bottom: 0; right: 0; top: 0; z-index: 0" />';

    document.body.appendChild(overlay);

    backgroundset=true;
    }
    else
    background.src=url;
    }
    //-->
    </SCRIPT>

    <title>
    TESTING
    </title>
    </head>
    <body onload="fixedBackground('clouds-03.jpg');">

  7. #7
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    See my message above

  8. #8
    SitePoint Member
    Join Date
    May 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    there's no document.write in the code that doesn't work

  9. #9
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Only because it outputs what you want doesn't mean that you did it correctly. Again, use document.close as well to avoid the spinning loading icon that makes it impossible to see the source.

  10. #10
    SitePoint Member
    Join Date
    May 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    document.open()/close() was added to http://spoonie3372.tripod.com/index.htm

    didnt work


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
  •