var head = headElement.firstChild;
var headTable = headElement.firstChild;
var body = bodyElement.firstChild;
var bodyTable = bodyElement.firstChild;

var a = body.offsetWidth;
alert(a);
var scrollBarWidth = body.offsetWidth - body.clientWidth;
headTable.style.width = Math.max(0, bodyTable.offsetWidth + scrollBarWidth);

offsetWidth is not supported in all browsers

var x,y;
var test1 = document.body.scrollHeight;
var test2 = document.body.offsetHeight
if (test1 > test2) // all but Explorer Mac
{
	x = document.body.scrollWidth;
	y = document.body.scrollHeight;
}
else // Explorer Mac;
     //would also work in Explorer 6 Strict, Mozilla and Safari
{
	x = document.body.offsetWidth;
	y = document.body.offsetHeight;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.