[thelist] JavaScript for body wrapper to be 100% height

Howard Jess hjess at cardomain.com
Tue Jan 9 11:37:37 CST 2007


jono at charlestonwebsolutions.com wrote:

> I know there are JavaScript solutions to make columns equal height; does
> anybody have a JavaScript solution that can make a "wrapper" <div> 100% of
> page's body width and height?

OK; untested, no error-checks, completely off the top of my head:

    window.onload = function() {
        var newDiv = document.createElement('div'),
            body = document.body;
        newDiv.style.height = '100%';
        newDiv.style.width = '100%';
        while(body.firstChild) newDiv.appendChild(body.firstChild);
        body.appendChild(newDiv);
    }


hj



More information about the thelist mailing list