473,408 Members | 2,832 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,408 software developers and data experts.

Wrong height

Hi All,

Problem: I'm adding a new span, setting its style, and after appending
it to its parent-span, the offsetHeight is changed automatically for
some reason... So instead of a square 14x14, I get a 14x24 rectangle.
Really strange.

Alittle code:

var obj = document.createElement("SPAN");
obj.id = oId;
with(obj.style)
{
top =Math.round (y*RePropY);
left =Math.round ( x*RePropX);
width = Math.round (w*RePropX);
height = Math.round (h*RePropY); // now the height is set to
14px
position = pos;
zIndex = z;
}
if (cName != "") obj.className = cName;
container.appendChild(obj);
// Now the height is still 14px, but the offsetHeight is showing 24

btw, using IE.

Any idea?

Thanks in advance,
Danny

Apr 11 '07 #1
1 1320
On Apr 11, 10:18 am, "Danny" <danyad...@yahoo.comwrote:
Hi All,

Problem: I'm adding a new span, setting its style, and after appending
it to its parent-span, the offsetHeight is changed automatically for
some reason... So instead of a square 14x14, I get a 14x24 rectangle.
Really strange.

Alittle code:

var obj = document.createElement("SPAN");
obj.id = oId;
with(obj.style)
{
top =Math.round (y*RePropY);
left =Math.round ( x*RePropX);
width = Math.round (w*RePropX);
height = Math.round (h*RePropY); // now the height is set to
14px
position = pos;
zIndex = z;
}
if (cName != "") obj.className = cName;
container.appendChild(obj);
// Now the height is still 14px, but the offsetHeight is showing 24

btw, using IE.

Any idea?

Thanks in advance,
Danny

I believe that since a span element is an 'inline' element, you cannot
specify certain attributes such as height.

Apr 11 '07 #2

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

Similar topics

4
by: fake | last post by:
What exactly does the line: rGfxOptionsWnd* m_pGfxOptionsWnd; do? I have chased this bug and narrowed it down to something that I believe should not happen and I don't even know what could...
9
by: datastructure | last post by:
Copyright (c) 2003 by James J. Perry. All Rights Reserved. char Square::validList = {'r', 'g', 'b'}; //missing an element, is 0 int Square::numValues = 3; Square::Square() { value =...
3
by: francisco lopez | last post by:
I hope not sent I twice. ok here is my problem, the javascript form validation works perfect during I put a emaildirection in the <form action:""> comand, like this: <form...
7
by: seeker | last post by:
Hi, Does anybody know what's wrong with the following code: <div align="center"><a href="flashplay.php" onclick="NewWindow(this.href,'Listen this!','280','280','no','random');return false" ...
4
by: _Raven | last post by:
Okay, I am playing with submitting forms with Ajax. I am trying to adapt this script to my forms: http://www.captain.at/howto-ajax-form-post-get.php I have included my code at the bottom of this...
6
by: amrhi | last post by:
Whats wrong with my code , i cant access to next page. Looks like the text field cant be read by login.php Thanks <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"...
7
by: Adam Nielsen | last post by:
Hi everyone, I'm having some trouble getting the correct chain of constructors to be called when creating an object at the bottom of a hierarchy. Have a look at the code below - the inheritance...
1
by: alvarojaviervera | last post by:
Allways I think Firefox was strong, enough ... and so far THE BEST Web- browser (That what I Think) but, now Im fighting with it, may be Im doing something wrong (of course that is what happend to...
2
by: firstexact | last post by:
Hi guys, First post, hope you can help, I have done two sites www.trisant.co.uk and my own www.firstexact.co.uk. The 2 x 2 grid I originally envisaged goes haywire in Firefox as I get a 4 high by...
2
by: everly | last post by:
Hi, I'm helping my friends band and making their MySpace. I messed something up and I can't figure out what it is. Everything is all out of whack on the bottom half of the page. The comments...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
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...

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.