473,395 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Sending page as XML lets offsetWIdth return 0

When use text/html as header for my page the method
element.offsetWIdth/Height work as usually and return the real
width/height of an element, but when I use XML as type (which is
necessary in modern browsers to use strict XHTML) the function returns
just 0.

Can somebody help me, it's very important. The prototype function
Element.getDimensions() doesn't work in strict mode.

Greetz
Andi

Nov 1 '06 #1
2 2731
ASM
webEater a écrit :
When use text/html as header for my page the method
element.offsetWIdth/Height work as usually and return the real
width/height of an element, but when I use XML as type (which is
necessary in modern browsers to use strict XHTML) the function returns
just 0.

Can somebody help me, it's very important. The prototype function
Element.getDimensions() doesn't work in strict mode.
Don't know this bidule.

http://www.quirksmode.org/js/findpos.html
http://www.quirksmode.org/js/elementdimensions.html

and see different compatibilities about sizes and browsers
Nov 1 '06 #2
webEater wrote:
When use text/html as header for my page the method
element.offsetWIdth/Height work as usually and return the real
width/height of an element, but when I use XML as type (which is
necessary in modern browsers to use strict XHTML) the function returns
just 0.
I don't understand what you are trying to say. offsetWidth and
offsetHeight are properties and not functions. If you want to send XHTML
as application/xhtml+xml (to browsers that support that like Mozilla or
Opera) then offsetWidth and offsetHeight are still properties and not
functions. And in a simple example it is not 0 that is returned but
rather values greater than null
<http://home.arcor.de/martin.honnen/javascript/2006/11/test2006110101.xhtml>
at least here for me with Mozilla and with Opera 9.
But you can send XHTML 1.0 as text/html and have it rendered in
standards compliant mode:
<http://home.arcor.de/martin.honnen/javascript/2006/11/test2006110102.html>

Unless you want to use mixed namespace documents like XHTML with MathML
and/or SVG there is not need to use XHTML. Stick with HTML 4.01 sent as
text/html.
The prototype function
Element.getDimensions() doesn't work in strict mode.
I don't think the author of that stuff reads comp.lang.javascript.


--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 1 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: SoloCDM | last post by:
Is there some kind of Javascript that will keep the web page at a fixed width? ********************************************************************* Signed, SoloCDM
3
by: mscir | last post by:
I'm adding text to a div using innerHTML, and watching the width of the div using offsetWidth. In IE the offsetWidth increases when the div gets wider, but in Netscape 7.2 or Firefox 1.0.3 it...
3
by: jdlwright | last post by:
Hi, I need to place a DIV exactly over a textarea element, but I can't calculate the correct value that I should set style.width to, because offsetWidth and style.width are calculated differently...
9
by: Miro | last post by:
VB 2003 at the end of the code, this works great. bytCommand = Encoding.ASCII.GetBytes("testing hello send text") udpClient.Send(bytCommand, bytCommand.Length) and this recieves it Dim...
1
by: DJG79 | last post by:
Hi all, I am using an open source menu that i found and it works great, except for one thing that when the web page is not scrolled to the very top the drop down links will not stay visible. Has...
15
by: colin | last post by:
Hi, Im familiar with c,c++ etc, and Ive spent a week trying to write my first app in c# it works reasonably well, but im having difficulty getting to grips with inter thread signalling etc. I...
2
by: Bjorn Sagbakken | last post by:
With ASP.NET 2.0 I want to add a nice and sleek feature to my application where the user typical clicks a button to open a smaller window to enable a search, lets say for customers or products...
3
by: shybe | last post by:
I have a send mail script on my site that. The emails are recieved by gmail, and yahoo, but not to mail clients like Outlook, Mail, etc...) Is this a problem with the script, or is it...
5
by: liketofindoutwhy | last post by:
for the code var node = document.getElementById("something") alert(node.offsetWidth) is very similar to node.clientWidth and node.scrollWidth I just wonder why offsetWidth is well...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
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...
0
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.