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

how can i detect the height of a TD tag?

Is there a way to detect the height of a TD tag?
Jul 20 '05 #1
2 11638
And on the day 7 Oct 2003 11:44:38 -0700, sh***@revealed.net enlightened
us with <a1**************************@posting.google.com>. ..
Is there a way to detect the height of a TD tag?


In recent browsers only, you can get the height of a table CELL (not a
tag - tags don't have a height).

Given the following cell:
<td id="whatever">...</td>

<script type="text/javascript">
myVar = document.getElementById?document.getElementById
("whatever").getAttribute("height"):0;
</script>

Browsers (older ones, like NN4) that do not support
document.getElementById would get 0 as the value.
--------------------------------------------------
~kaeli~
Kill one man and you are a murderer. Kill millions
and you are a conqueror. Kill everyone and you
are God.
http://www.ipwebdesign.net/wildAtHeart/
http://www.ipwebdesign.net/kaelisSpace/
------------------------------------------------
Jul 20 '05 #2
DU
kaeli wrote:
And on the day 7 Oct 2003 11:44:38 -0700, sh***@revealed.net enlightened
us with <a1**************************@posting.google.com>. ..
Is there a way to detect the height of a TD tag?

In recent browsers only, you can get the height of a table CELL (not a
tag - tags don't have a height).

Given the following cell:
<td id="whatever">...</td>

<script type="text/javascript">
myVar = document.getElementById?document.getElementById
("whatever").getAttribute("height"):0;
</script>


but here, there is no height attribute defined for the "whatever" cell,
so myVar will hold null. Height is not a valid attribute in strict DTD
anyway.

OTOH, document.getElementById("whatever").offsetHeight will return the
general pixel height of the cell.

Tested and working in Opera 7.20, Mozilla 1.5RC2, MSIE 6 and NS 7.1.

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html

Jul 20 '05 #3

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

Similar topics

157
by: Dennis | last post by:
Is there some way --using, say, DOM or javascript-- to detect the current pixel width and/or height of a relatively sized table or of one of its columns or rows. I'm going to be writing javascript...
1
by: simchajoy2000 | last post by:
Is there anyway to dynamically detect the screen resolution of a client's computer in ASP.NET?? All the code I have found on the internet was specifically for Access forms. I found this code: ...
2
by: Jake | last post by:
Hi, I have a page with a bunch of thumbnails that when clicked, open the full size image in a new window. They are all different sizes and its a bit unprofessional looking. I'd like to find a...
4
by: Mark | last post by:
I am loading source files into several iframes, with each load happening after some user-generated event (like clicking a button). The loading works but I need to determine when the source file is...
1
by: Kristian | last post by:
I'm including an application into a customer website using an iframe. Some of the pages have a scrollbar since their height expands the height of the iframe. My problem is, I need to resize the...
3
by: andrew.neale | last post by:
Hello, I have a div that has an overflow set to auto. I would like to know if the scrollbars are visible in javascript. Any help is appreciated. Thanks
4
by: vunet | last post by:
When user enlarges font with Ctrl+ I want to increase the dimensions of my fixed sized div. IE7 uses zoom-in, so it will increase div dimensions automatically. Firefox, however, increases font...
1
by: azura | last post by:
how can i get this textfield auto detect?? because i try not to using view name button... i want when i enterd this matric no., the student name will appear automatically when i insert the matric...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
marktang
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,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.