Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #10448

Re: Shrinking the width of a WIDTH=100% table

Message-ID <1936358.aqSPkdTlGX@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2012-01-20 22:17 +0100
Subject Re: Shrinking the width of a WIDTH=100% table
Newsgroups comp.lang.javascript
References <8nsih7pjdunj21096qub8tnr1mluk2bons@4ax.com>
Followup-To comp.lang.javascript

Followups directed to: comp.lang.javascript

Show all headers | View raw


Swifty wrote:

> I have a CGI script that builds a table with "WIDTH=100%"

First of all, CGI is an obsolete technology [1].  Use server extensions or 
FastCGI [2] instead.

> There are many paths through the code, but they all required the table
> to be WIDTH=100%

Second, do not do that.  Learn and apply CSS instead [3].
 
> Now, I find that in just one of the paths, it would be better if that
> WIDTH=100% had not been specified.
> 
> Is there any JavaScript that I can insert, after the <TABLE> has
> already been started, which  will remove the effect of the WIDTH=100%

Since the `width' attribute has no specified default value [4], the only 
proper way is to program what you would do manually: remove the attribute.

  elem.removeAttribute("width");

However, if you had used CSS, you could have reset the `width' property to 
its specified initial value [3, 5]:

  elem.style.width = "auto";


PointedEars
___________
[1] <http://en.wikipedia.org/wiki/Common_Gateway_Interface#Drawbacks>
[2] <http://www.fastcgi.com/drupal/>
[3] <http://www.w3.org/TR/CSS21/visudet.html#propdef-width>
[4] <http://www.w3.org/TR/html4/struct/tables.html#adef-width-TABLE>
[5] <http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSS2Properties>
-- 
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Shrinking the width of a WIDTH=100% table Swifty <steve.j.swift@gmail.com> - 2012-01-20 14:04 +0000
  Re: Shrinking the width of a WIDTH=100% table Captain Paralytic <paul_lautman@yahoo.com> - 2012-01-20 06:20 -0800
  Re: Shrinking the width of a WIDTH=100% table "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-01-20 17:04 +0200
    Re: Shrinking the width of a WIDTH=100% table Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-01-20 16:35 +0100
      Re: Shrinking the width of a WIDTH=100% table "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-01-20 19:45 +0200
      Re: Shrinking the width of a WIDTH=100% table Swifty <steve.j.swift@gmail.com> - 2012-01-20 18:49 +0000
    Re: Shrinking the width of a WIDTH=100% table "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2012-01-22 13:57 -0800
  Re: Shrinking the width of a WIDTH=100% table Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-01-20 22:17 +0100
    Re: Shrinking the width of a WIDTH=100% table Swifty <steve.j.swift@gmail.com> - 2012-01-21 06:28 +0000
      Re: Shrinking the width of a WIDTH=100% table "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-01-21 11:07 +0000
      Re: Shrinking the width of a WIDTH=100% table Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-01-21 19:52 +0100
        Re: Shrinking the width of a WIDTH=100% table Swifty <steve.j.swift@gmail.com> - 2012-01-22 06:54 +0000
          Re: Shrinking the width of a WIDTH=100% table Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-01-22 14:06 +0100
            Re: Shrinking the width of a WIDTH=100% table "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-01-22 15:17 +0200
            Re: Shrinking the width of a WIDTH=100% table Swifty <steve.j.swift@gmail.com> - 2012-01-23 06:52 +0000
              Re: Shrinking the width of a WIDTH=100% table Swifty <steve.j.swift@gmail.com> - 2012-01-23 07:10 +0000
              Re: Shrinking the width of a WIDTH=100% table Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-01-23 16:36 +0100
  Re: Shrinking the width of a WIDTH=100% table Dr J R Stockton <reply1203@merlyn.demon.co.uk> - 2012-01-21 20:50 +0000
    Re: Shrinking the width of a WIDTH=100% table Swifty <steve.j.swift@gmail.com> - 2012-01-22 06:42 +0000

csiph-web