使用JS在IE中查找浏览器高度? [英] Using JS to find browser height in IE??

查看:50
本文介绍了使用JS在IE中查找浏览器高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,这个布局上有一个javascript问题 - 一切都好了

很棒,除了我们想用div编写代码,我们想要这个

页脚留在页面底部,无论如何。


我们已经看了一堆不同的分辨率检测脚本,但是

我们不想解决 - 我们想要innerHeight / clientHeight,所以我们可以

告诉屏幕大小有多大,即使人们看不到我们的

他们的浏览器最大化的网站。


但是我们的脚本有问题,因为虽然Firefox

很喜欢它,IE仍然会返回一个值0的0表示0。因为它的高度。


我们真的很难过!任何人都知道什么是错的?


(其中一些是PHP,一些是JavaScript,所以你可能需要

下载其中一个文件 -
http://efiction.incompetentgirl。 com / ... tra_header.php

..)


你可以看到
http://efiction.incompetentgirl.com/...p?list=作者

如果你检查源代码并寻找第二个checkRes操作。


非常感谢你!

解决方案

ka ******** @ gmail.com 在11/18/2006 8:04 PM发表以下内容:


嘿,这个布局上有一个javascript问题 - 一切'走了。

很棒,除了我们想用div编写代码,我们希望这个

页脚留在页面的底部,无论如何。


我们已经看了一堆不同的分辨率检测脚本,但是我们不想要解决这个问题 - 我们想要innerHeight / clientHeight,所以我们可以

告诉屏幕尺寸有多大,即使人们在浏览器最大化时没有看到我们的

网站。


但是''我们的脚本出了问题,因为虽然Firefox很好,但IE仍然保持返回0的值。因为它的高度。



查看论坛常见问题:


< URL:http://jibbering.com/faq/#FAQ4_9>


-

兰迪

机会有利于准备好的心灵

comp.lang.javascript常见问题 - http://jibbering.com/faq

Javascript Best实践 - http://www.JavascriptToolbox.com/bestpractices/


我不确定你想让我修复哪一部分,但是我们尝试更改它

到 -


函数findPageHeight(){

if(typeof window.innerHeight!=''undefined''){

return window.innerHeight;

}

if(document.documentElement&& typeof

document.documentElement.clientWidth!=''undefined''&&

document.documentElement.clientHeight!= 0){

返回document.documentElement.clientHeight;

}

if(document.body&& typeof document.body.clientWidth!=''undefined''){

返回document.body.clientHeight;

}

return(null );

}


- 它没有用。你可以提供更详细的帮助

赞赏。

Randy Webb写道:

ka ******** @ gmail.com 在11/18/2006 8:04 PM发表以下内容:


嘿,这个布局上有一个javascript问题 - 一切都好了

很棒,除了我们想用div编写代码,我们想要这个

页脚留在页面底部,无论如何。


我们已经看过一堆不同的分辨率检测脚本,但是

我们不想要解决 - 我们想要innerHeight / clientHeight,所以我们可以

告诉屏幕尺寸有多大,即使人们看不到在我们的

网站上,他们的浏览器最大化。


但我们的脚本有问题,因为虽然Firefox

喜欢它,IE继续返回值0。因为它的高度。



查看论坛常见问题:


< URL:http://jibbering.com/faq/#FAQ4_9>


-

兰迪

机会有利于准备好的心灵

comp.lang.javascript常见问题 - http://jibbering.com/faq

Javascript Best实践 - http://www.JavascriptToolbox.com/bestpractices/


ka ******** @ gmail.com 在2006年11月18日下午9:01发表以下内容:


我不确定你希望我修复哪一部分,但我们尝试更改它

到 -


函数findPageHeight(){

if(typeof window.innerHeight!=''undefined'') {

返回window.innerHeight;

}

if(document.documentElement& && typeof

document.documentElement.clientWidth!=''undefined''&&

document.documentElement.clientHeight!= 0){

返回document.documentElement.clientHeight;

}

if(document.body&& typeof document.body.clientWidth!=''undefined''){

返回document.body.clientHeight;

}

return(null );

}


- 它没有用。您可以提供的任何更详细的帮助将是

赞赏。



这个函数不是我的,它是由RobG编写的,但它已知为

工作 - 完美无缺 - 来自FAQ代码。


函数findPageHeight(){

var winWidth,winHeight,d = document;

if(typeof window.innerWidth !=''undefined''){

winWidth = window.innerWidth;

winHeight = window.innerHeight;

}否则如果(d .documentElement

&& typeof d.documentElement.clientWidth!=''undefined''

&& d.documentElement.clientWidth!= 0){

winWidth = d.documentElement.clientWidth;

winHeight = d.documentElement.clientHeight;

}否则如果(d.body

&& typeof d.body.clientWidth!=''undefined''){

winWidth = d.body.clientWidth;

winHeight = d .body.clientHeight;

}

alert(''winWidth:''+ winWidth

+''\ nwinHeight:''+ winHeig ht);

}


-

兰迪

机会有利于预备心灵

comp.lang.javascript常见问题 - http://jibbering.com/faq

Javascript最佳实践 - http://www.JavascriptToolbox .com / bestpractices /


Hey, having a javascript problem on this layout-- Everything''s going
great, except we want to code it just with divs, and we want this
footer to stay at the bottom of the page, no matter what.

We''ve looked at a bunch of different resolution detection scripts, but
we don''t want resolution -- we want innerHeight/clientHeight, so we can
tell how big the screen size is even when people aren''t looking at our
site with their browsers maximized.

But there''s something wrong with our script, because while Firefox
likes it fine, IE keeps returning a value of "0" for its height.

We''re really stumped! Anyone know what''s wrong?

(Some of it is in PHP, some in JavaScript, so you might need to
download one of the files --
http://efiction.incompetentgirl.com/...tra_header.php
..)

You can see the script in action at
http://efiction.incompetentgirl.com/...p?list=authors ,
if you check the sourcecode and look for the second checkRes operation.

Thank you so much!

解决方案

ka********@gmail.com said the following on 11/18/2006 8:04 PM:

Hey, having a javascript problem on this layout-- Everything''s going
great, except we want to code it just with divs, and we want this
footer to stay at the bottom of the page, no matter what.

We''ve looked at a bunch of different resolution detection scripts, but
we don''t want resolution -- we want innerHeight/clientHeight, so we can
tell how big the screen size is even when people aren''t looking at our
site with their browsers maximized.

But there''s something wrong with our script, because while Firefox
likes it fine, IE keeps returning a value of "0" for its height.

Check the group FAQ:

<URL: http://jibbering.com/faq/#FAQ4_9>

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


I''m not sure which part you wanted me to fix, but we tried changing it
to--

function findPageHeight(){
if (typeof window.innerHeight!=''undefined'') {
return window.innerHeight;
}
if (document.documentElement && typeof
document.documentElement.clientWidth!=''undefined'' &&
document.documentElement.clientHeight!=0) {
return document.documentElement.clientHeight;
}
if (document.body && typeof document.body.clientWidth!=''undefined'') {
return document.body.clientHeight;
}
return (null);
}

--and it didn''t work. Any more detailed help you can give would be
appreciated.
Randy Webb wrote:

ka********@gmail.com said the following on 11/18/2006 8:04 PM:

Hey, having a javascript problem on this layout-- Everything''s going
great, except we want to code it just with divs, and we want this
footer to stay at the bottom of the page, no matter what.

We''ve looked at a bunch of different resolution detection scripts, but
we don''t want resolution -- we want innerHeight/clientHeight, so we can
tell how big the screen size is even when people aren''t looking at our
site with their browsers maximized.

But there''s something wrong with our script, because while Firefox
likes it fine, IE keeps returning a value of "0" for its height.


Check the group FAQ:

<URL: http://jibbering.com/faq/#FAQ4_9>

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


ka********@gmail.com said the following on 11/18/2006 9:01 PM:

I''m not sure which part you wanted me to fix, but we tried changing it
to--

function findPageHeight(){
if (typeof window.innerHeight!=''undefined'') {
return window.innerHeight;
}
if (document.documentElement && typeof
document.documentElement.clientWidth!=''undefined'' &&
document.documentElement.clientHeight!=0) {
return document.documentElement.clientHeight;
}
if (document.body && typeof document.body.clientWidth!=''undefined'') {
return document.body.clientHeight;
}
return (null);
}

--and it didn''t work. Any more detailed help you can give would be
appreciated.

This function is not mine, it was written by RobG, but it is known to
work - flawlessly - and comes from the FAQ code.

function findPageHeight(){
var winWidth, winHeight, d=document;
if (typeof window.innerWidth!=''undefined'') {
winWidth = window.innerWidth;
winHeight = window.innerHeight;
} else if ( d.documentElement
&& typeof d.documentElement.clientWidth!=''undefined''
&& d.documentElement.clientWidth!=0 ) {
winWidth = d.documentElement.clientWidth;
winHeight = d.documentElement.clientHeight;
} else if ( d.body
&& typeof d.body.clientWidth!=''undefined'') {
winWidth = d.body.clientWidth;
winHeight = d.body.clientHeight;
}
alert(''winWidth: '' + winWidth
+ ''\nwinHeight: '' + winHeight);
}

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


这篇关于使用JS在IE中查找浏览器高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆