i have this javascript code :
function pageWidth() {
return (window.innerWidth != null
? window.innerWidth
: (document.body != null
? document.body.offsetWidth
: null
));
}
function bodyloaded() {
winWidth = pageWidth();
window.scroll(0, 0);
scrAmount = Math.floor(
((document.body['scrollWidth'] - document.body.offsetWidth)/2) + 8
);
scrollBy(scrAmount, 0);
}
and is applied on body tags in methods onload and onresize , the problem is if i put any doctype , this code doesnt work on firefox but works on IE. I debug the value of scrollWidth and offsetWidth , and allways get the same value , this happend using a Doctype.
Any solution?