+ Reply to Thread
Results 1 to 7 of 7

Thread: Blank page...?

  1. #1
    DecemberGuild is offline x10 Sophmore DecemberGuild is an unknown quantity at this point
    Join Date
    Oct 2006
    Posts
    107

    Blank page...?

    I'm using a script that doesn't seem to be working how I want it to.
    I need the script to check the size of the scrollbars based on a DIV element on the page, and then return the size (this script is not mine).
    I added another script to combine that with a CSS tag so that the script will parse the proper CSS tag based on the scrollbar width on the page.

    I'm getting a problem. When I run the first script, which tests the DIV's scrollbar width, it erases the pages and replaces it with its results. So, instead of seeing the new CSS tag added near the top of my page, I'm seeing a page with nothing on it except that CSS tag.

    Here is my page: [link]

    Here is the script:
    <script>
    function getScrollerWidth() {
    var scr = null;
    var inn = null;
    var wNoScroll = 0;
    var wScroll = 0;
    // Outer scrolling div
    scr = document.createElement('div');
    scr.style.position = 'absolute';
    scr.style.top = '-1000px';
    scr.style.left = '-1000px';
    scr.style.width = '100px';
    scr.style.height = '50px';
    // Start with no scrollbar
    scr.style.overflow = 'hidden';
    // Inner content div
    inn = document.createElement('div');
    inn.style.width = '100%';
    inn.style.height = '200px';
    // Put the inner div in the scrolling div
    scr.appendChild(inn);
    // Append the scrolling div to the doc
    document.body.appendChild(scr);
    // Width of the inner div sans scrollbar
    wNoScroll = inn.offsetWidth;
    // Add the scrollbar
    scr.style.overflow = 'scroll';
    // Width of the inner div width scrollbar
    wScroll = inn.offsetWidth;
    // Remove the scrolling div from the doc
    document.body.removeChild(
    document.body.lastChild);
    // Pixel width of the scroller
    return (wNoScroll - wScroll);
    }
    </script>
    <script>
    function stylescroll() {
    document.write("<style>#footerContainer { padding-right:" + getScrollerWidth() + "px; }</style>");
    }
    window.onload = stylescroll;
    </script>
    Here is the outcome of the script:
    <style>#footerContainer { padding-right:17px; }</style>
    I sincerely thank you for any and all help.
    Last edited by DecemberGuild; 11-07-2006 at 11:28 PM.

  2. #2
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: Blank page...?

    It looks like there are two sets of "<html><body>" and "</body></html>" tags on that page. Maybe that is the problem?
    Last edited by Bryon; 11-07-2006 at 11:34 PM.

  3. #3
    mattyranks's Avatar
    mattyranks is offline x10 Sophmore mattyranks is an unknown quantity at this point
    Join Date
    Oct 2006
    Posts
    156

    Re: Blank page...?

    1. there is an extra <html> tag in the middle of the page

    2. There are two <head></head> sections

  4. #4
    DecemberGuild is offline x10 Sophmore DecemberGuild is an unknown quantity at this point
    Join Date
    Oct 2006
    Posts
    107

    Re: Blank page...?

    I know this. It works as is.
    This is happening because I am using PHP to set frames, and the page is being included with its HTML, HEAD and BODY tags.

    This is not the problem. The problem is the script, and I'm sure of it.


    Edit: I don't think you're seeing what happens. When the page is maximized, it blanks out to white.
    Last edited by DecemberGuild; 11-08-2006 at 02:49 PM.

  5. #5
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: Blank page...?

    "document.body.removeChild(document.body.lastChild );"

    If there are two body tags in the DOM, wouldn't that cause a problem? I may be wrong but.. If it's still not working, it's worth a try to remove one of them, in my opinion.

  6. #6
    DecemberGuild is offline x10 Sophmore DecemberGuild is an unknown quantity at this point
    Join Date
    Oct 2006
    Posts
    107

    Re: Blank page...?

    Well, that may be it. I didn't even realize that.
    But I'm going to use a different method. This method delays the page load a bit and doesn't work as I wanted it to.

  7. #7
    aking47 is offline x10Hosting Member aking47 is an unknown quantity at this point
    Join Date
    Oct 2006
    Posts
    13

    Re: Blank page...?

    Even though you've decided not to use this... You can't use document.write after a page has loaded. use document.createElement or document.createTextNode if you want to add something to a page after it has loaded.

+ Reply to Thread

Similar Threads

  1. blank page...
    By ymca in forum Free Hosting
    Replies: 6
    Last Post: 04-11-2006, 09:31 AM
  2. PHP-NUKE Not working...Blank Page
    By Anton in forum Free Hosting
    Replies: 1
    Last Post: 12-23-2005, 06:58 AM
  3. Ads on Every Page?
    By ThaoD in forum Free Hosting
    Replies: 5
    Last Post: 08-23-2005, 05:44 PM
  4. Cannot edit in Front Page
    By katyW in forum Free Hosting
    Replies: 9
    Last Post: 05-26-2005, 06:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers