473,769 Members | 6,739 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Resizing table height

JMT

Hello,

I get some dynamic controls (ASP .Net) inside a table, the height
property of the table is variable according the controls loaded, so I
need to know the final table height, this value must be an odd number
by graphic design. I put the next code at bottom of the page;
<script type="text/javascript" language="JavaS cript1.2">
if (document.getEl ementById("TABL E1").clientHeig ht%2 == 0)
document.getEle mentById("TABLE 1").height =
document.getEle mentById("TABLE 1").clientHeigh t + 1;

</script>
Works fine in IE6 & IE7, in Firefox 2 and Opera 9 doesn't works, I've
checked with alert(document. getElementById( "TABLE1").heigh t)
and I can see the result desired, but the height of the table remains
and doesn't change in the page. ¿Is there any solution for it works
in Firefox and Opera?
Many thanks.
Apr 30 '07 #1
2 8366
JMT wrote:
Hello,

I get some dynamic controls (ASP .Net) inside a table, the height
property of the table is variable according the controls loaded, so I
need to know the final table height, this value must be an odd number
by graphic design. I put the next code at bottom of the page;
<script type="text/javascript" language="JavaS cript1.2">
if (document.getEl ementById("TABL E1").clientHeig ht%2 == 0)
document.getEle mentById("TABLE 1").height =
document.getEle mentById("TABLE 1").clientHeigh t + 1;

</script>
Works fine in IE6 & IE7, in Firefox 2 and Opera 9 doesn't works, I've
checked with alert(document. getElementById( "TABLE1").heigh t)
and I can see the result desired, but the height of the table remains
and doesn't change in the page. ¿Is there any solution for it works
in Firefox and Opera?
Many thanks.

There is no height property for the table tag, that's why it doesn't
work in standards compliant browsers. When you set the height property,
a new member is created in the table object, but it's not used for anything.

Use the style.height property to set the height of the table. Don't
forget to append the 'px' unit when you set the value.

--
Göran Andersson
_____
http://www.guffa.com
Apr 30 '07 #2
JMT
Thank you Göran, now it works!

if (document.getEl ementById("TABL E1").clientHeig ht%2 == 0)
document.getEle mentById("TABLE 1").style.heigh t =
parseInt(docume nt.getElementBy Id("TABLE1").cl ientHeight + 1) + 'px';

Regards.

"Göran Andersson" <gu***@guffa.co mescribió en el mensaje
news:el******** ******@TK2MSFTN GP02.phx.gbl...
JMT wrote:
>Hello,

I get some dynamic controls (ASP .Net) inside a table, the height
property of the table is variable according the controls loaded, so I
need to know the final table height, this value must be an odd number
by graphic design. I put the next code at bottom of the page;
<script type="text/javascript" language="JavaS cript1.2">
if (document.getEl ementById("TABL E1").clientHeig ht%2 == 0)
document.getEle mentById("TABLE 1").height =
document.getEl ementById("TABL E1").clientHeig ht + 1;

</script>
Works fine in IE6 & IE7, in Firefox 2 and Opera 9 doesn't works, I've
checked with alert(document. getElementById( "TABLE1").heigh t)
and I can see the result desired, but the height of the table remains
and doesn't change in the page. ¿Is there any solution for it works
in Firefox and Opera?
Many thanks.


There is no height property for the table tag, that's why it doesn't work
in standards compliant browsers. When you set the height property, a new
member is created in the table object, but it's not used for anything.

Use the style.height property to set the height of the table. Don't forget
to append the 'px' unit when you set the value.

--
Göran Andersson
_____
http://www.guffa.com

Apr 30 '07 #3

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

Similar topics

6
16213
by: §Þ¦w | last post by:
How can i get the table height by Javascript
9
2866
by: john T | last post by:
Is there any way to input he screen.height information into <Table Height=> so I can have my page auto center vertically. I don't want to use CSS because it disrupts other tables.
7
33976
by: Angelus | last post by:
I want a table to be 100% as high as the viewable area of the page. Well, of course, TABLE HEIGHT is no longer an attribute, so I did a work around using STYLE="height:100%" and <BODY STYLE="height:100%">. It works great in IE but in Netscape it takes height=100% too literally and if the page is the slightest bit taller it just cuts it off and doesn't expand like IE does. Does anyone know of a workaround for this? Thank you, Angelus
9
9979
by: alex | last post by:
Hi, It seems like HTML 4.01 Transitional spec. doesn't allow table height to be expressed in percents. When i have this doctype tag: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> the percents don't work.
1
2493
by: Derek Fountain | last post by:
I seem to recall from long ago that the TABLE HEIGHT attribute was deprecated (or was Netscape only, or something). Hmmm... I have a web page with a table which controls layout - one row with 3 columns. The left column contains another table containing the left side menu, and the right side column contains another table for the right side menu. The main content of the page goes in the middle. Those two sub-tables are coloured, but as...
7
1964
by: Arthur Dent | last post by:
I am completely baffled... i cannot for the life of me get the HEIGHT style to work on a table in the new 2005-supported XHTML. I put a HEIGHT: 100% on my table so that my footer row will also show up at the very bottom of the page (unless content pushes it further down). But when the browser renders the page, its as if there was no height specified on the table, it all just shrinks up to the top of the page, as short as the content will...
0
2160
by: Markus Olderdissen | last post by:
i want to create my page with 100% height. <table height="100%"works but is not correct by default. i saw various information how to do it with stylesheet. i really have problems to create my page. i want to have header on top and footer on bottom. content should be on top of the middle part. i always got scrollbars, even if my page isn't too large. perhaps, someone can show me to do it right. the following code describes my wish. ...
1
1900
by: maz77 | last post by:
How can I force a table to get an height of 100% with CSS? I'm using VisualStudio 2005. Thanks MAX
2
3100
dlite922
by: dlite922 | last post by:
My site has multiple section each divided into tables (I'm using tables because the other developers slept through HTML 101) The section table must be a certain height and contains a header (th) cell and a td body cell. What IE6 ignores is the height of the th element (which is 20 or 30px). it works fine in FF but in IE6 it takes up almost 40% of the table. As I put content into the body cells it pushes the TH back to correct size in IE6. ...
0
10216
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, 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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9997
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.