Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Setting Table Width Dynamically

Posted on 2000-03-07
6
Medium Priority
?
152 Views
Last Modified: 2006-11-17
I am trying to find a way to dynamically set the table width in Netscape.  I have no problem doing it in IE.  In IE, I give the table an id="tablename".  Up in the Javascript code, I then reference it by document.tablename.width = 458;

How can I do this in Netscape?
0
Comment
Question by:paulca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 8

Expert Comment

by:jbirk
ID: 2594683
I don't think you can.

But if you put the table into a div tag with absolute positioning (layer) you can rewrite the entire table every time you need to resize it.  I think these layers are the only way to do this kind of dynamic content for netscape...

-Josh
0
 

Author Comment

by:paulca
ID: 2596170
I have it inside a div tag now.  How do rewrite the entire table by using the DIV tag?
0
 
LVL 8

Accepted Solution

by:
jbirk earned 300 total points
ID: 2596224
Well, it looks something like this:
if (document.layers)
 {document.layername.document.open();
  document.layername.document.write(divText);
  document.layername.document.close();
 }

Just set all of the text contained in the div to the variable divText.  Any changes you make to this text will be shown in the layer when you write it like I did above.  Keep in mind that that is the method for doing this in Netscape.  In IE, it would look more like this:
if (document.all)
 document.layername.innerHTML = divText;

For netscape you also have to be sure to specify a style for the div tag which includes "position:absolute;top:xx;left:xx;" (fill in the xx's)  If you don't do this then it's not considered a layer, and you can't treat it dynamically...

-Josh
0
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 

Author Comment

by:paulca
ID: 2596601
I have a large table and I want the width to change depending on the resolution.  Is there a cleaner way than the method you mentioned above?
0
 

Author Comment

by:paulca
ID: 2596647
I have a large table and I want the width to change depending on the resolution.  Is there a cleaner way than the method you mentioned above?
0
 
LVL 8

Expert Comment

by:jbirk
ID: 2598153
Yeah, in this case, it's easier to just have seperate HTML pages and redirect to the appropriate page using javascript.  Whatever you are using for determining which size to use now, you can use to do this redirect.  Just use document.location = "index800.html"; // 800 X 600
or something like that.

If you put the code in the header then it will redirect before even loading the entire page...

-Josh
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question