5 Replies - 1186 Views - Last Post: 14 June 2002 - 10:34 AM

#1 objekt404  Icon User is offline

  • Whiskey Tango Foxtrot!?

Reputation: 0
  • View blog
  • Posts: 1,568
  • Joined: 15-April 01

Quick Javascript Question

Post icon  Posted 13 June 2002 - 08:43 PM

ok, i would never ask anything so simple as this probably is, but:

i need a script/tut/code sample to monitor the width of a table.

example: if i'm making a centered web page (some don't like them, but coming from print I do) nested in a 3 column table (no CSS here), I need to know how wide the left column is for a Fireworks dropdown (was that clear enough?)

I've been through my O'Rielly "Learning JS" book time & again & can't find *anything* resembling what I'm looking for. Help!

obj.404 :: the JS neophyte

Is This A Good Question/Topic? 0
  • +

Replies To: Quick Javascript Question

#2 The Neoracle  Icon User is offline

  • Check, check, 1, 2.
  • member icon

Reputation: 21
  • View blog
  • Posts: 4,097
  • Joined: 30-March 01

Re: Quick Javascript Question

Posted 13 June 2002 - 09:08 PM

Does it have to be dynamic?

Can't you just open the page in a wysiwyg and select the cell and have it tell you that?
Was This Post Helpful? 0
  • +
  • -

#3 Cookie Mobster  Icon User is offline

  • nooneenooneenooonee
  • member icon

Reputation: 7
  • View blog
  • Posts: 4,730
  • Joined: 12-October 01

Re: Quick Javascript Question

Post icon  Posted 13 June 2002 - 10:26 PM

Well here is a little IE javascript (it will not work with Opera, Moz, Netscape)..
<script>
function get_table(src){
      return src.style.width;
}
document.write('the width of table 1 is: '+ get_table('table1'));
</script>
<table>
   <tr>
       <td id="table1">
          this is the first column
       </td>
       <td>
          column 2
       </td>
       <td>
          final column
       </td>
     </tr>
</table>


That is a start you can work in the layers and all object referances if you need cross browser support but I didn't want to get into all of that.

Cheers Sam
Was This Post Helpful? 0
  • +
  • -

#4 objekt404  Icon User is offline

  • Whiskey Tango Foxtrot!?

Reputation: 0
  • View blog
  • Posts: 1,568
  • Joined: 15-April 01

Re: Quick Javascript Question

Posted 13 June 2002 - 10:28 PM

The Neoracle, on Jun 13 2002, 10:08 PM, said:

Does it have to be dynamic?

Can't you just open the page in a wysiwyg and select the cell and have it tell you that?

see, that's the rub; it does have to be dynamic. Fireworks menus rely on absolute positions. w/o a proper 'X' location, the menu might/will popup in the wrong place (looking really crappy to boot!)

i guess what i'm basically asking is: how do i set a var to = whatever the current left column width is (+Y for the offset of the 'main' column).

basically, the center column *is* the site(kinda like yahoo). the left padding column is 'only' there to give a location/margin var. how do i get the menu script to read the left column amt.? :blink:
Was This Post Helpful? 0
  • +
  • -

#5 The Neoracle  Icon User is offline

  • Check, check, 1, 2.
  • member icon

Reputation: 21
  • View blog
  • Posts: 4,097
  • Joined: 30-March 01

Re: Quick Javascript Question

Posted 14 June 2002 - 10:24 AM

Oh!

Then I don't know. ;)
Was This Post Helpful? 0
  • +
  • -

#6 Cookie Mobster  Icon User is offline

  • nooneenooneenooonee
  • member icon

Reputation: 7
  • View blog
  • Posts: 4,730
  • Joined: 12-October 01

Re: Quick Javascript Question

Posted 14 June 2002 - 10:34 AM

^^^ up there mista.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1