clientHeight在FireFox [英] clientHeight in FireFox

查看:141
本文介绍了clientHeight在FireFox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML代码表。

I have a table in HTML code.

我需要使用JavaScript获取该表的高度,所以

I need to get height of that table using JavaScript, so

alert(document.getElementById('myTable').clientHeight);

在IE中返回正确的值,但总是在FF中返回0。

returns a correct value in IE, but always returns 0 in FF.

如何在Firefox中获取表的高度?

How can I get the height of the table in Firefox?

谢谢!

推荐答案

MDC说:


clientHeight 是Internet Explorer中引入的非标准HTML特定属性对象模型。

clientHeight is a non-standard, HTML-specific property introduced in the Internet Explorer object model.

在Firefox中, offsetHeight 属性包含元素的当前像素高度,因此可以使用以下内容:

In Firefox, the offsetHeight property contains the current pixel height of an element, so you can use something like:

var theHeight = element.clientHeight || element.offsetHeight;

这篇关于clientHeight在FireFox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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