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


Groups > comp.lang.javascript > #14893 > unrolled thread

Creating tables on the fly using ---> var tbl=document.createElement("table");

Started byBob <Go1369@yahoo.com>
First post2012-07-05 22:25 -0700
Last post2012-07-06 14:47 -0700
Articles 4 — 2 participants

Back to article view | Back to comp.lang.javascript


Contents

  Creating tables on the fly using --->   var tbl=document.createElement("table"); Bob <Go1369@yahoo.com> - 2012-07-05 22:25 -0700
    Re: Creating tables on the fly using --->   var tbl=document.createElement("table"); David Mark <dmark.cinsoft@gmail.com> - 2012-07-05 22:48 -0700
    Re: Creating tables on the fly using --->   var tbl=document.createElement("table"); Bob <Go1369@yahoo.com> - 2012-07-06 08:21 -0700
      Re: Creating tables on the fly using --->   var tbl=document.createElement("table"); David Mark <dmark.cinsoft@gmail.com> - 2012-07-06 14:47 -0700

#14893 — Creating tables on the fly using ---> var tbl=document.createElement("table");

FromBob <Go1369@yahoo.com>
Date2012-07-05 22:25 -0700
SubjectCreating tables on the fly using ---> var tbl=document.createElement("table");
Message-ID<2f39371c-f9f1-41f8-979c-ce7dd73db1a3@googlegroups.com>
Like this

        var tbl=document.createElement("table");

Then I want to make the table width 100% like this

        tbl.setAttribute('width','100%');

It only works some of the time. As I'm dynamically adding rows and cells the table shrinks to a much small width and looks crummy.

Anybody got any ideas?

Thanks in advance,

Bob Sweeney


[toc] | [next] | [standalone]


#14894

FromDavid Mark <dmark.cinsoft@gmail.com>
Date2012-07-05 22:48 -0700
Message-ID<f222b419-df77-4f0b-a1a1-4acf531991d4@googlegroups.com>
In reply to#14893
On Friday, July 6, 2012 1:25:25 AM UTC-4, Bob wrote:
> Like this
> 
>         var tbl=document.createElement("table");
> 
> Then I want to make the table width 100% like this
> 
>         tbl.setAttribute('width','100%');

What made you settle on setAttribute? You virtually never need that method (and certainly not for this).

Why not use CSS instead?

> 
> It only works some of the time.

http://jibbering.com/faq/notes/posting/#ps1DontWork

> As I'm dynamically adding rows and cells the table shrinks to a much small width and looks crummy.

That is unfortunate. :(

[toc] | [prev] | [next] | [standalone]


#14908

FromBob <Go1369@yahoo.com>
Date2012-07-06 08:21 -0700
Message-ID<27a7dd89-db1c-4eb5-b6bf-269d847b7d90@googlegroups.com>
In reply to#14893
On Friday, July 6, 2012 1:25:25 AM UTC-4, Bob wrote:
> Like this
> 
>         var tbl=document.createElement("table");
> 
> Then I want to make the table width 100% like this
> 
>         tbl.setAttribute('width','100%');
> 
> It only works some of the time. As I'm dynamically adding rows and cells the table shrinks to a much small width and looks crummy.
> 
> Anybody got any ideas?
> 
> Thanks in advance,
> 
> Bob Sweeney

Can you supply an example of how you would do that?

[toc] | [prev] | [next] | [standalone]


#14918

FromDavid Mark <dmark.cinsoft@gmail.com>
Date2012-07-06 14:47 -0700
Message-ID<4d7460bf-ebc3-4d59-939a-e5f279546787@googlegroups.com>
In reply to#14908
On Friday, July 6, 2012 11:21:24 AM UTC-4, Bob wrote:
> On Friday, July 6, 2012 1:25:25 AM UTC-4, Bob wrote:
> > Like this
> > 
> >         var tbl=document.createElement("table");
> > 
> > Then I want to make the table width 100% like this
> > 
> >         tbl.setAttribute('width','100%');
> > 
> > It only works some of the time. As I'm dynamically adding rows and cells the table shrinks to a much small width and looks crummy.
> > 
> > Anybody got any ideas?
> > 
> > Thanks in advance,
> > 
> > Bob Sweeney
> 
> Can you supply an example of how you would do that?

With CSS (e.g. width: 100%). Or I would set the "width" property (as opposed to using the dreaded setAttribute method).

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web