Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 22nd, 2005, 05:36 AM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
Default get width when there is no style defined?

Hi all,
Assume you've got a table with dynamic contents and you haven't assigned any style or class name which specifies the width or height of the table. If u try the codes below u'll face the following results:

alert(document.getElementById("theTable").style.he ight);
 --> will alert:nothing(blank)
        alert(document.getElementById("theTable").currentS tyle.height);
 -->will alert:auto

alert(document.getElementById("theTable").style.pi xelHeight);
 -->will alert:0
        alert(document.getElementById("theTable").currentS tyle.pixelHeight);
 -->will alert:undefined

So what shall I do. It doesn't matter if it only works on IE...

 
Old October 22nd, 2005, 06:55 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

As far as I know, a table's pixelHeight property will return 0 until you GIVE it the property.

 
Old October 22nd, 2005, 08:50 AM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That's exactly my observation which I also mentioned above but what else can I use to give me the current height of an object...

 
Old October 26th, 2005, 07:35 AM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It is 3 days now and no one proposed any solution but I managed to find one after going up and down in msdn library. fortunatly it works as well in other browser other than IE:
object.clientHeight





Similar Threads
Thread Thread Starter Forum Replies Last Post
ADODB.Connection user-defined type not defined Wall st Guru Excel VBA 2 March 26th, 2014 03:44 PM
Appl-defined or Object-defined error 1004 chp Excel VBA 3 April 4th, 2006 08:12 AM
User-defined type not defined (Icecream.mdb) dloren01 BOOK: Beginning Access VBA 0 June 22nd, 2005 10:36 PM
Width in pixels from width in percentage bsausser Classic ASP Basics 1 December 31st, 2003 02:31 PM
Application-defined or object-defined error James Excel VBA 1 August 12th, 2003 11:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.