[thelist] Browser innerWidth for IE4/5/6?

Peter-Paul Koch gassinaumasis at hotmail.com
Thu May 24 04:57:56 CDT 2001



>I can get it for NN4x by using
>
>    if (ns4) redLight = window.innerWidth
>    // heh heh, redLight to stop the car; get it??
>
>but for IE5,
>
>    if (ie5) redLight =  document.body.offsetWidth
>    if (ie5) redLight =  document.body.scrollWidth
>
>don't work; window.innerWidth locks IE5 up, cuz

IE needs document.body.clientWidth . Your current browser detect is 
incorrect, it leaves out Netscape 6 and the minor browsers. Besides, 
detecting the browser is not necessary here:

>function init() {

if (self.innerWidth) redLight = self.innerWidth
else if (document.body) redLight = document.body.clientWidth


>	if (ns4) block = document.blockDiv
>	if (ie5) block = blockDiv.style
>   	block.left = -400       // This was the right place
>to start the
>	                        // car off screen to the left
>	block.xpos = parseInt(block.left)
>}
>//-->
></script>

ppk

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.





More information about the thelist mailing list