如何检测桌子宽度或高度? [英] How to detect table width or height?

查看:107
本文介绍了如何检测桌子宽度或高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法 - 比如使用DOM或javascript--检测

当前像素宽度和/或相对大小的表格的高度或

其中一个列或行。我要写javascript到

将我的页面调整到查看器的浏览器窗口尺寸,这个

肯定会有很好的信息。


谢谢....

丹尼斯

Is there some way --using, say, DOM or javascript-- to detect the
current pixel width and/or height of a relatively sized table or of
one of its columns or rows. I''m going to be writing javascript to
adjust my page to the viewer''s browser window dimensions and this
would sure be great information to have.

Thanks ....
Dennis

推荐答案




Dennis写道:


Dennis wrote:
有没有办法 - 比如使用DOM或javascript--来检测
当前的像素宽度和/或相对大小的表格的高度或其中一列或多行的高度。我将编写javascript来调整我的页面到浏览器的浏览器窗口尺寸,这肯定是很好的信息。
Is there some way --using, say, DOM or javascript-- to detect the
current pixel width and/or height of a relatively sized table or of
one of its columns or rows. I''m going to be writing javascript to
adjust my page to the viewer''s browser window dimensions and this
would sure be great information to have.




使用IE4 +,Netscape 6 +,Opera 7,你可以阅读

element.offsetWidth

element.offsetHeight

of any页面中的元素。所以尝试

var元素;

if(document.all)

element = document.all [''elementId''];

else if(document.getElementById)

element = document.getElementById(''elementId'');

if(element){

//读取element.offsetWidth / element.offsetHeight这里

}

正如你的问题和答案不是关于HTML而是JavaScript我已经
交叉到comp.lang.javascript并设置跟进。


-


Martin Honnen
http://JavaScript.FAQTs.com/




" Dennis" < theonlyDennis@removeForSpam_mindspring.com>在消息中写道

news:vv ******************************** @ 4ax.com ...

"Dennis" <theonlyDennis@removeForSpam_mindspring.com> wrote in message
news:vv********************************@4ax.com...
有没有办法 - 比如使用DOM或javascript--来检测当前像素宽度和/或相对大小的表格的高度或者
其中一个列或行。我将编写javascript来调整我的页面到浏览器的浏览器窗口尺寸,这肯定是很好的信息。
Is there some way --using, say, DOM or javascript-- to detect the
current pixel width and/or height of a relatively sized table or of
one of its columns or rows. I''m going to be writing javascript to
adjust my page to the viewer''s browser window dimensions and this
would sure be great information to have.




为什么在使用灵活的

布局时诉诸BS javascript欺骗?

-

Karl Core


有时一个人仍忠于某一事业只是因为它的对手不会因为b $ b不再平淡无奇。

Friedrich Nietzsche


八分之三ATnninethree.com



Why resort to BS javascript trickery when you can just use a flexible
layout?
--
Karl Core

At times one remains faithful to a cause only because its opponents do not
cease to be insipid.
Friedrich Nietzsche

eightninethree AT eightninethree.com


文章< vv *************** *****************@4ax.com>在

comp.infosystems。 www.authoring.html ,丹尼斯

< theonlyDennis@removeForSpam_mindspring.com>写道:
In article <vv********************************@4ax.com> in
comp.infosystems.www.authoring.html, Dennis
<theonlyDennis@removeForSpam_mindspring.com> wrote:
我将写javascript来
调整我的页面到浏览器的浏览器窗口尺寸
I''m going to be writing javascript to
adjust my page to the viewer''s browser window dimensions




哦,上帝,我们再来一次。


-

Stan Brown,Oak Road Systems,美国纽约州科特兰县
http://OakRoadSystems.com/

HTML 4.01规范:< a rel =nofollowhref =http://www.w3.org/TR/html401/target =_ blank> http://www.w3.org/TR/html401/

验证者: http://validator.w3.org/

CSS 2规范: http:// www。 w3.org/TR/REC-CSS2/

2.1更改: http://www.w3.org/TR/CSS21/changes.html

验证者: http://jigsaw.w3.org/css-validator/



Oh god, here we go again.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/


这篇关于如何检测桌子宽度或高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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