CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2005
    Posts
    7

    Get document's/table's real size using JS

    Hi all,
    I've created a web page that contains only a table, and I need to get the page's size.

    I've tried using document.documentElement.scrollHeight or document.body.scrollHeight but I get the browser's window size and not only body's.

    I thought about passing over all the table's TR's and sum all heights and widths. Something like:
    table = document.getElementById("tblForm");
    for (i=0 ; i<table.numRows ; i++)
    height += table.rows[i].height.

    for (i=0 ; i<table.numCols ; i++)
    width += table.cols[i].width.

    Does JavaScript has the properties for doing that, or is there any other way to know the table's/body's size?
    Help will be truly appreciated
    Last edited by druven; July 24th, 2005 at 03:00 AM.

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Get document's/table's real size using JS

    If it was not specified in the parameters of the <table> tag, then it cannot be done.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured