Forum Moderators: open
My problem is that IE is displaying the incorrect width.
The strange part is, if I place this function on a different webpage, the value is suddenly correct. I am implementing the code in my global header include file.
Here's the function:
<script type="text/javascript">
function wid(){
winW = 0;
if (parseInt(navigator.appVersion)>3) {
if (navigator.appName=="Netscape") {
winW = window.innerWidth-16;
}
if (navigator.appName.indexOf("Microsoft")!=-1) {
winW = document.body.offsetWidth-20;
}
}
alert(winW); //debug
if(winW > 1000){
ad = "HTML code here";
document.body.innerHTML += ad;
}}
window.onload = wid;
</script>
When used in the global header file, the script outputs 984. In another page, with no header include, it outputs 1004 as expected.
Any ideas? I suspect it's some error in my HTML, yet I can't find it.
[webmasterworld.com...]