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 12 1265
Álvaro G. Vicario wrote:
Jens escribió:
>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ó:
>>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ón web: http://bits.demogracia.com
-- Mi web de humor al baño Mar*a: http://www.demogracia.com
--
=?UTF-8?B?IsOBbHZhcm8 gRy4gVmljYXJpby I=?= wrote on 23 jul 2008 in
comp.lang.javas cript:
Thomas 'PointedEars' Lahn escribió:
>>>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)
Ok, sticking to event then although it's not perfect.
Follow up question: Where can i find some up-to-date information about
what dhtml firefox. In perticular what style object attributes are set
the by the rendering engine when they are not explicitly set in the
css? For instance, let's say i need to find the absolute x and y co-
ordinates of an object that is positioned relative or using the float
or displayed inline, top and left are not set in the css; Will these
attributes
be set automatically by the rendering engine? Is there some other
method of retrieving them?
Ok, sticking to event then although it's not perfect.
Follow up question: Where can i find some up-to-date information about
what dhtml firefox. In perticular what style object attributes are set
the by the rendering engine when they are not explicitly set in the
css? For instance, let's say i need to find the absolute x and y co-
ordinates of an object that is positioned relative or using the float
or displayed inline, top and left are not set in the css; Will these
attributes
be set automatically by the rendering engine? Is there some other
method of retrieving them?
Ok, sticking to event then although it's not perfect.
Follow up question: Where can i find some up-to-date information about
what dhtml firefox. In perticular what style object attributes are set
the by the rendering engine when they are not explicitly set in the
css? For instance, let's say i need to find the absolute x and y co-
ordinates of an object that is positioned relative or using the float
or displayed inline, top and left are not set in the css; Will these
attributes
be set automatically by the rendering engine? Is there some other
method of retrieving them?
Jens wrote:
Ok, sticking to event then although it's not perfect.
What are you referring to? <http://learn.to/quote/>
Follow up question: Where can i find some up-to-date information about
what dhtml firefox.
This is not a question, it is a gibberish statement. If you are unable
to utter understandable questions in English, then, although this is an
international newsgroup and English is not a requirement, you would be
better of posting in a newsgroup for your native language instead. From
your headers I assume that is German, in which case you should post to
de.comp.lang.ja vascript (I am posting there, too.)
In perticular what style object attributes are set
the by the rendering engine when they are not explicitly set in the
css?
That depends on the rendering/layout engine.
For instance, let's say i need to find the absolute x and y co-
ordinates of an object that is positioned relative or using the float
or displayed inline, top and left are not set in the css; Will these
attributes be set automatically by the rendering engine?
Style *properties* are defined in a user agent's default stylesheet and
rendered by the layout engine accordingly. They can be overwritten in the
cascade with user stylesheets and author stylesheets. In CSS1, author
stylesheets could overwrite user stylesheets with `!important'. In CSS2 and
later, user stylesheets can overwrite author stylesheets with `!important'
instead.
Is there some other method of retrieving them?
Other than recursing upwards over the proprietary offset* properties?
Unfortunately, no.
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
The Magpie wrote:
You seem to be under a misapprehension here, Jens. Let's be blunt (if
a little simplistic) - think of it this way:
No, don't.
DHTML is only available on MSIE. Its not quite true, but its good
enough to work with.
It isn't. Please don't try impose your misconceptions on others.
All others use a rendering engine based on
stylesheets of which there are three main kinds.
At least the IE Developer Toolbar shows how utterly mistaken you are about
MSIE here.
In fact, DHTML does not have anything to do with that. It is instead a
common buzzword for using client-side scripting to manipulate the DOM,
which is by far not only available in MSIE.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8************ *******@news.de mon.co.uk>
The Magpie wrote:
You do often seem to forget, Thomas, that questions asked are often of
the "what should I do" sort rather than technical aspects of how
things work. Simplicity - even if it is not strictly correct - is
often the best help.
IBTD. Simplicity like this, when it it ultimately leads to factually wrong
answers, is the worst kind of help that could be given.
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bryan R. Meyer |
last post by:
Hello Everyone,
The problem of browser resizing has become an issue for me. While
redesigning my webpage, I set the left and right margins to be auto so
that my content would be centered. However, there are images that I
used absolute positioning in order to place them in the appropriate
location on my page. When I do a browser resize,...
|
by: Jack Hughes |
last post by:
This argument has come up two or three times lately.
We have a web standards document at our company that say "Use valid
HTML 4; We don't recommend switching to DIV-based CSS-P for layout
just yet though, tables are a lot easier."
That's because we have a lot of developers who aren't ready to move to
CSS-P and DIVs just yet.
But I'm...
|
by: Jane Withnolastname |
last post by:
I am trying to re-work an old site by replacing the html with css.
On the main page, I have a logo image which I needed centred on the
initial screen. I found the solution here:
http://www.wpdfd.com/editorial/wpd0103.htm#toptip (the second example)
The problem is, under the image is a large table. But using the above
positioning, now the...
|
by: Gregor |
last post by:
I am trying to use an image map with a mouseover function to show
various DIV tags. I am not an expert, but what I've come up with works
in IE but not in FireFox. Any insight would be greatly appreciated.
Below is the js and CSS code
<SCRIPT TYPE="text/javascript">
<!--
var layerRef="",styleSwitch="",curMenu="";
|
by: Aurelio |
last post by:
I'm developing a Web application with ASP.NET and C# and i'm having problems
with Opera and FireFox. The controls don't appear situated correctly. Why?.
What ca i do?
| |
by: Dave |
last post by:
I am designing a web page using VS2003 ASP.NET. The page contains various
DIVs (panels), one of which is in grid layout. The controls in this DIV
render correctly in IE, but when using Firefox they are incorrectly
positioned. VS sets the positioning of the controls to absolute, and because
the DIV is to the right of another DIV Firefox...
|
by: dontwantspam |
last post by:
Hello everyone,
I'm working on this css site redesign
http://www.maranathamalta.com/4given/testingmain.php
I've tested on my machine running XP using Firefox 2.0.0.4, IE6 and IE7.
It looks right on those browsers.
However on some other machines running XP, MacOS and Linux, using firefox 2 and
firefox 1.5, the cross graphic gets shifted...
|
by: Mig |
last post by:
I just purchased a Wordpress theme and am customizing it. It uses a
javascript tabbed content area with a script called tabber.js. I'd
already made dozens or hundreds of changes in various templates before
bothering to look at the site in IE7 (always using Firefox 2). The
entire tab area simply doesn't appear in IE. Works fine in Firefox....
|
by: SAL |
last post by:
Hello, I did google this issue and found some stuff related to BrowserCaps
section of either web.config or machine.config but it didn't work.
It seems that most pages in my webapp are okay but a couple of the Firefox
is munging up.
So, on my information page there is a gridview in the content section of the
page. The masterpage contains...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |