Loading ...
Sorry, an error occurred while loading the content.

Re: [JavaScript] Change width of tag

Expand Messages
  • Foteos Macrides
    ... From: joeandtelus To: javascript_official@yahoogroups.com Sent: Wednesday, March 31, 2004 5:21 PM Subject: [JavaScript] Change width of tag If I want
    Message 1 of 1 , Mar 31, 2004
    • 0 Attachment
      ----- Original Message -----
      From: joeandtelus
      To: javascript_official@yahoogroups.com
      Sent: Wednesday, March 31, 2004 5:21 PM
      Subject: [JavaScript] Change width of <TD> tag

      If I want to make the width of a <TD> to get wider; then how do I do
      that using JavaScript?
      You can give the td a unique id, e.g., id="mytd" in the original HTML markup, and then with javascript use, say,

      document.getElementById('mytd').width=600;

      to make it wider (600 pixels in this hypothetical case) if the value of

      document.getElementById('mytd').offsetWidth

      is less than 600. The .offsetWidth is read-only, and gives the present actual width, whereas the .width is read-write and corresponds to the td's width attribute value. That means it is a "recommended width" and the actual width can be affected by the content of the td and/or the surrounding markup. For example, it cannot be made narrower than the width of an image in the td.

      Fote
      --



      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.