火狐定位。替换MSIE像pixelToppixelWidth renderStyle的最佳实践 [英] firefox positioning. Best practices replacing MSIEs pixelToppixelWidth renderStyle

查看:62
本文介绍了火狐定位。替换MSIE像pixelToppixelWidth renderStyle的最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在尝试为网站构建一个简单的下拉菜单,我需要

需要一种方法来检索

对象的顶部和左侧样式属性。然而似乎风格

属性如style.top

a并不总是可用,我认为,取决于

问题中的对象是否定位相对或绝对。


我已经能够使用event.pageX和event.pageY取得一些成功,

但它并不是真的适当的

我想要的是什么


MSIE曾经有过像素值,它返回了一个数值,而且还有一个
的renderStyle这将返回一个

自动布局对象的计算样式值,但是在firefox中我没有这样的东西,而且我认为它不是标准的.dh不是标准的。 br />

使用标准在javascript中获取x,y co-

坐标的推荐(和万无一失)方法是什么?

非浏览器特定的dhtml?


我感谢你对此有任何反馈。


- Jens

解决方案

?? lvaro G. Vicario写道:


Jens escribi?3:


> I我正在尝试为网站构建一个简单的下拉菜单,我需要一种方法来检索对象的顶部和左侧样式属性。然而,似乎风格
属性,如style.top
一个并不总是可用,我认为,取决于
问题中的对象是相对还是绝对定位。



[...]


>什么是推荐(和万无一失)的方式使用标准的非浏览器特定的dhtml在javascript中获取x,y co-
坐标?



我所知道的唯一万无一失的方法是使用框架:jQuery,mootools,

prototype ...它们都提供了计算任何功能的函数元素大小和

位置,它们已在多个浏览器中进行过测试。



ROTFL。他们只是在一些浏览器的最新版本中进行了测试

,他们相当无能的开发人员可以使用(你注意到它甚至没有在哪个平台上提到过
那些试图向我们保证质量的测试是否已经完成?)。而且他们写在第一个

的地方写得不好(使用浏览器嗅探并制造其他荒谬的错误),所以他们

被测试为工作可能也是巧合。


我们之前讨论过这个令人作呕的事情(没有实质性的反驳

他们的开发人员的批评),你建议不要使用

他们也不推荐他们。

PointedEars

-

任何拍这个的人页面最好用浏览器X''标签浏览

a网页似乎渴望过去的糟糕时光,在网络之前,

当你几乎没有机会阅读另一台计算机,另一台文字处理器或其他网络上写的文件。 - Tim Berners-Lee


Thomas''PointedEars''Lahn escribi?3:


>>非浏览器特定的dhtml?


我所知道的唯一万无一失的方法是使用框架:jQuery,mootools,
原型......它们都提供计算任何元素大小和位置的函数他们已经在几个浏览器中测试过。



ROTFL。他们只是在一些浏览器的最新版本中进行了测试

,他们相当无能的开发人员可以使用(你注意到它甚至没有在哪个平台上提到过
那些试图向我们保证质量的测试是否已经完成?)。而且他们写在第一个

的地方写得不好(使用浏览器嗅探并制造其他荒谬的错误),所以他们

被测试为工作可能也是巧合。


我们之前讨论过这个令人作呕的事情(没有实质性的反驳

他们的开发人员的批评),你建议不要使用

他们也不推荐他们。



有趣的是:所有现有的框架都非常糟糕,新手编写的任何代码片段都会有更高的浏览器兼容性。


唯一的问题是我对你的意见不在乎,先生

所有开发人员除了我以外都很糟糕,我很确定我不是唯一一个。

如果你对所有事情的强烈意见通常无可争议我会说b $ b敢说这是因为没有人喜欢与之讨论你:当你不喜欢这些意见时,你倾向于批评这个人,而你似乎认为这是一种受教条影响的宗教信仰。


* plonk *

-

- http://alvaro.es - ?? lvaro G. Vicario - 西班牙布尔戈斯

- Mi sitio sobre programaci?3n web: http://bits.demograci a.com

- Mi web de humor al ba?±o Mar?* a: http://www.demogracia.com

-


=?UTF-8 ?B?IsOBbHZhcm8gRy4gVmljYXJpbyI =?=写于2008年7月23日在

comp.lang.javascript


Thomas''PointedEars''Lahn escribi?3:


>>>非浏览器特定的dhtml?
我所知道的唯一万无一失的方法是使用一个框架:jQuery,
mootools,prototype ......它们都提供了计算任何元素大小和位置的函数,并且它们已经在几个方面进行了测试/>浏览器。


ROTFL。它们只是在一些浏览器的最新版本中进行了测试,这些浏览器是他们相当无知的开发人员可用的(你是否注意到它甚至没有在哪些平台上提到测试试图尝试保证我们的质量得到了执行?)。并且它们首先写得不好(使用浏览器嗅探和制造其他荒谬的错误),所以它们被测试为工作可能也是纯粹的巧合。
<我们之前已经讨论了这个令人作呕的事情(没有对他们的开发人员的批评进行实质性的反驳),并且建议你不要使用它们而不是推荐它们。



有趣的是:所有现有的框架都非常可怕,以至于新手编写的任何代码片段/ b $ b代码都将拥有更优越的浏览器

兼容性。


唯一的问题是我对你的意见不在乎,先生

所有开发人员除了我以外都很糟糕,我很确定我不是唯一一个

。如果你对所有事情的强烈意见通常仍然存在

无可争议我敢说这是因为没有人愿意与你讨论:

你倾向于批评这个人你不喜欢这些意见和

你似乎认为JavaScript是一种受教条约束的宗教。


* plonk *



亲爱的朋友,我从未见过一个不受教条影响的宗教信仰,

你的教条似乎是你不喜欢听到的声音

与你的意见相矛盾,亲爱的指责也是如此。


这不会压扁他的耳朵或阻止他说出他的意思,因为

这是usenet,但是它显示了你自己的宗派主义,保持你的b / b $ b b宗教类比。


顺便说一句,[OT]关于usenet的[off topic]并不意味着你改变了主题,

但是手头的主题不是章程允许的一个主题。

NG。在这种情况下你被错误添加了。


==========


Pointed'的ROTFL在我看来回应你的万无一失

in我所知道的唯一万无一失的方式是使用框架。


我想他在这里完全是对的,[但是因为滚动地板可能会损害他的耳朵],因为那些图书馆肯定不是万无一失的,你不会那么傻到考虑到这一点。


不使用图书馆并自己努力工作会给你

你不仅要更满意,还要提高你的学习曲线,但

知道你的代码做了你想做的事情,至少在你经过广泛测试的

平台上。

-

Evertjan。

荷兰。

(请在我的电子邮件地址中将x'变为点数)

Hi everyone,

I''m trying to build a simple dropdown menu for a website and i need to
need a way to retrieve
the top and left style attributes of an object. However it seems style
attributes like style.top
a not always available, depeding, i think, on whether the object in
question is positioned relatively or absolutely.

I''ve been able to use event.pageX and event.pageY with some success,
but it''s not really apropriate
for what i wan''t

MSIE used to have pixelTop which returned a numerical value and also
the renderStyle which would return the calculated style value of a
auto layouted object, but nothing like this available in firefox and I
assume it isn''t standard.dhtml anyway.

What is the recommeded (and fool-proof) way to get the x, y co-
ordinates in javascript using standard
non-browser specific dhtml?

I appreciate any feedback you might have on this.

- Jens


解决方案

??lvaro G. Vicario wrote:

Jens escribi?3:

>I''m trying to build a simple dropdown menu for a website and i need to
need a way to retrieve
the top and left style attributes of an object. However it seems style
attributes like style.top
a not always available, depeding, i think, on whether the object in
question is positioned relatively or absolutely.

[...]

>What is the recommeded (and fool-proof) way to get the x, y co-
ordinates in javascript using standard
non-browser specific dhtml?


The only foolproof way I know is using a framework: jQuery, mootools,
prototype... They all offer functions to calculate any element size and
position and they''ve been tested in several browsers.

ROTFL. They have been only tested in the latest versions of a few browsers
that their rather clueless developers had available (did you notice that it
is not even mentioned on which platforms the tests that attempt to assure us
of their quality were performed?). And they are poorly written in the first
place (using browser sniffing and making other ridiculous blunders), so them
being tested as working may as well be sheer coincidence.

We have discussed that ad nauseam here before (with no substantial rebuttal
of the criticism from their developers), and you are well-advised not to use
them and not to recommend them as well.
PointedEars
--
Anyone who slaps a ''this page is best viewed with Browser X'' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee


Thomas ''PointedEars'' Lahn escribi?3:

>>non-browser specific dhtml?

The only foolproof way I know is using a framework: jQuery, mootools,
prototype... They all offer functions to calculate any element size and
position and they''ve been tested in several browsers.


ROTFL. They have been only tested in the latest versions of a few browsers
that their rather clueless developers had available (did you notice that it
is not even mentioned on which platforms the tests that attempt to assure us
of their quality were performed?). And they are poorly written in the first
place (using browser sniffing and making other ridiculous blunders), so them
being tested as working may as well be sheer coincidence.

We have discussed that ad nauseam here before (with no substantial rebuttal
of the criticism from their developers), and you are well-advised not to use
them and not to recommend them as well.

Interesting: all existing frameworks are so terrible that any snippet of
code written by a newbie will have a far superior browser compatibility.

The only problem is that I couldn''t care less about your opinions, Mr.
All Developers Suck Except Me, and I''m pretty sure I''m not the only one.
If your strong opinions about everything normally remain undisputed I''d
dare say it''s because nobody likes to discuss with you: you tend to
criticize the person when you don''t like the opinions and you seem to
think JavaScript is a religion subject to dogma.

*plonk*
--
-- http://alvaro.es - ??lvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programaci?3n web: http://bits.demogracia.com
-- Mi web de humor al ba?±o Mar?*a: http://www.demogracia.com
--


=?UTF-8?B?IsOBbHZhcm8gRy4gVmljYXJpbyI=?= wrote on 23 jul 2008 in
comp.lang.javascript:

Thomas ''PointedEars'' Lahn escribi?3:

>>>non-browser specific dhtml?
The only foolproof way I know is using a framework: jQuery,
mootools, prototype... They all offer functions to calculate any
element size and position and they''ve been tested in several
browsers.


ROTFL. They have been only tested in the latest versions of a few
browsers that their rather clueless developers had available (did you
notice that it is not even mentioned on which platforms the tests
that attempt to assure us of their quality were performed?). And
they are poorly written in the first place (using browser sniffing
and making other ridiculous blunders), so them being tested as
working may as well be sheer coincidence.

We have discussed that ad nauseam here before (with no substantial
rebuttal of the criticism from their developers), and you are
well-advised not to use them and not to recommend them as well.


Interesting: all existing frameworks are so terrible that any snippet
of code written by a newbie will have a far superior browser
compatibility.

The only problem is that I couldn''t care less about your opinions, Mr.
All Developers Suck Except Me, and I''m pretty sure I''m not the only
one. If your strong opinions about everything normally remain
undisputed I''d dare say it''s because nobody likes to discuss with you:
you tend to criticize the person when you don''t like the opinions and
you seem to think JavaScript is a religion subject to dogma.

*plonk*

Dear friend, I never saw a religion that was not subject to dogma,
your dogma seems to be that you do not like to hear voices that
contradict your opinions, and so killfiling dear Pointed.

That will not flatten his ears or stop him from uttering his meaning, for
this is usenet, but it shows your own sectarianism, to keep your
religious analogy.

btw, [OT] for [off topic] on usenet does not mean you change the subject,
but that the subject at hand is not a subject allowed by charter for a
NG. Wrongly added in this case by you.

==========

Pointed''s ROTFL seems to me in response to your "foolproof"
in "The only foolproof way I know is using a framework".

I think here he is completely right, [but for the fact that rolling over
the floor could harm his ears], because those libraries are certainly not
foolproof, you would be a fool not to take that into account.

And not using the libraries and doing the hard work yourself will give
you not only more satisfaction and enhance your learning curve, but the
knowledge that your code does what you wanted it to do, at least on the
platforms you extensively tested.
--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)


这篇关于火狐定位。替换MSIE像pixelToppixelWidth renderStyle的最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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