如何在Opera 12中找到页面宽度(对于桌面Windows)? [英] How to find page width in Opera 12 (for Desktop Windows)?

查看:160
本文介绍了如何在Opera 12中找到页面宽度(对于桌面Windows)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要存取全页宽度&高度在Opera。注意我不是问Viewport的高度或宽度,我想要页面/文档的宽度&高度。我使用的是Opera 12.12。

I want to access full page width & height in Opera. Note I am not asking about Viewport's height or width, I want page's/document's width & height. I am using Opera 12.12

我已经尝试过以下操作:

I have tried the following:


  1. body.scrollWidth / Height

  2. document.body.offsetWidth / Height

  3. window.innerWidth / Height

  4. document.body.clientWidth / Height

  1. document.body.scrollWidth/Height
  2. document.body.offsetWidth/Height
  3. window.innerWidth/Height
  4. document.body.clientWidth/Height

所有这些都给视口的宽度/高度。

And all of them gives viewport's width/height.

请使用以下链接:
http://jsfiddle.net/RQhYR/

或使用以下HTML页面

Or use the following HTML Page

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
<html>
<body>
    <div style="width:2000px;height:2000px;background-color: blue;"></div>
</body>
<script type="text/javascript">
    alert(window.outerWidth + "," + window.outerHeight);
</script>
</html>


推荐答案

$ c> body.offsetWidth / Height , body.scrollWidth / Height body.clientWidth / Height (使用与你相同的构建)。只有 window.innerWidth / 身高

I'm getting the correct values from body.offsetWidth/Height, body.scrollWidth/Height and body.clientWidth/Height (using the same build as you). Only window.innerWidth/Height is supposed to return browser window viewport.

也许你有一些奇怪的CSS设置尺寸的身体到视口,并将滚动条放在内部的某个元素。在你的情况下,我从< html> scrollWidth / Height 获得2000 x 2000 px的预期值$ c>,请参阅演示

Maybe you've got some odd CSS that sets the dimensions of the body to the viewport and puts the scrollbar on an element somewhere inside. In your case, I'm getting the expected values of 2000 x 2000 px from the scrollWidth/Height of the <html>, see demo.

这篇关于如何在Opera 12中找到页面宽度(对于桌面Windows)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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