473,385 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Dynamically changing a cell content

Hi, I'm using the code below to change the contents of a cell table in IE.
The problem is that the cell size won't adjust to the size of the content,
as its positions have been declared 'absolute'. If I change that to
relative, the cell is sized to contain all the contents, and not just the
visible one.

Is there any solution to this? What I would like is, ideally, that the cell
size takes the largest width and height it is going to have, or if that's
not possible, the size of the current contents being shown.

Thanks!!

<code>
<html><head></head>
<body>
<script>
function show(name) {
document.all[name].style.visibility = 'visible';
}
function hide(name) {
document.all[name].style.visibility = 'hidden';
}

</script>
<form>
<input type=button onclick="hide('table2');show('table1');" value="Show 1">
<input type=button onclick="hide('table1');show('table2');" value="Show 2">

</form>

<table border=3>
<tr>
<td>one</td>
<td>two</td>
</tr>
<tr>
<td>
AAAAAAAAA
</td>
<td>
<div id=option style='position:relative'>

<table border=1 id=table1 style='position:absolute; visibility:hidden'>
<tr><td>
BBBB<br>
CCCC<br>
DDDD<br>
</td>
</tr>
</table>

<div id=table2 style='position:absolute; visibility:hidden'>
lqdflkjqndflkn
</div>
</div>
</td>
</tr>
</table>

</body></html>
</code>
Jul 20 '05 #1
2 9932
I think what you're looking for is .style.display = '' vs. .style.display = ''
and not .style.visibility
Csaba Gabor from New York

"Joe Smith" <no****@nospam.com> wrote in message news:bl**********@news-reader1.wanadoo.fr...
Hi, I'm using the code below to change the contents of a cell table in IE.
The problem is that the cell size won't adjust to the size of the content,
as its positions have been declared 'absolute'. If I change that to
relative, the cell is sized to contain all the contents, and not just the
visible one.

Is there any solution to this? What I would like is, ideally, that the cell
size takes the largest width and height it is going to have, or if that's
not possible, the size of the current contents being shown.

Thanks!!

<code>
<html><head></head>
<body>
<script>
function show(name) {
document.all[name].style.visibility = 'visible';
}
function hide(name) {
document.all[name].style.visibility = 'hidden';
}

</script>
<form>
<input type=button onclick="hide('table2');show('table1');" value="Show 1">
<input type=button onclick="hide('table1');show('table2');" value="Show 2">

</form>

<table border=3>
<tr>
<td>one</td>
<td>two</td>
</tr>
<tr>
<td>
AAAAAAAAA
</td>
<td>
<div id=option style='position:relative'>

<table border=1 id=table1 style='position:absolute; visibility:hidden'>
<tr><td>
BBBB<br>
CCCC<br>
DDDD<br>
</td>
</tr>
</table>

<div id=table2 style='position:absolute; visibility:hidden'>
lqdflkjqndflkn
</div>
</div>
</td>
</tr>
</table>

</body></html>
</code>

Jul 20 '05 #2
should be vs. .style.display='none'

"Csaba2000" <ne**@CsabaGabor.com> wrote in message news:bl********@dispatch.concentric.net...
I think what you're looking for is .style.display = '' vs. .style.display = ''
and not .style.visibility
Csaba Gabor from New York

"Joe Smith" <no****@nospam.com> wrote in message news:bl**********@news-reader1.wanadoo.fr...
Hi, I'm using the code below to change the contents of a cell table in IE.
The problem is that the cell size won't adjust to the size of the content,
as its positions have been declared 'absolute'. If I change that to
relative, the cell is sized to contain all the contents, and not just the
visible one.

Is there any solution to this? What I would like is, ideally, that the cell
size takes the largest width and height it is going to have, or if that's
not possible, the size of the current contents being shown.

Thanks!!

<code>
<html><head></head>
<body>
<script>
function show(name) {
document.all[name].style.visibility = 'visible';
}
function hide(name) {
document.all[name].style.visibility = 'hidden';
}

</script>
<form>
<input type=button onclick="hide('table2');show('table1');" value="Show 1">
<input type=button onclick="hide('table1');show('table2');" value="Show 2">

</form>

<table border=3>
<tr>
<td>one</td>
<td>two</td>
</tr>
<tr>
<td>
AAAAAAAAA
</td>
<td>
<div id=option style='position:relative'>

<table border=1 id=table1 style='position:absolute; visibility:hidden'>
<tr><td>
BBBB<br>
CCCC<br>
DDDD<br>
</td>
</tr>
</table>

<div id=table2 style='position:absolute; visibility:hidden'>
lqdflkjqndflkn
</div>
</div>
</td>
</tr>
</table>

</body></html>
</code>


Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Free-Ed, Ltd. | last post by:
I am going nuts trying to find a paragraph in a book that described how to change the text content (HTML) in a DIV. Actually I have an array of HTML strings that I want to drop into the DIV,...
31
by: Arthur Shapiro | last post by:
I'm the webmaster for a recreational organization. As part of one page of the site, I have an HTML "Calendar at a Glance" of the organization's events for the month. It's a simple table of a...
31
by: Greg Scharlemann | last post by:
Given some recent success on a simple form validation (mainly due to the kind folks in this forum), I've tried to tackle something a bit more difficult. I'm pulling data down from a database and...
0
by: Thanh Nguyen | last post by:
Hi everyone, I'm encountering a very weird problem, I have spent the last 3 days trying to figure out how to fix but there is still no clue. Here is the problem: I define 2 WebUserControls: -...
0
by: Tonix | last post by:
This problem was originated by Thanh Nguyen. Your help is appreciated. Thanks. The original text is: Hi everyone, I'm encountering a very weird problem, I have spent the last 3 days trying to...
2
by: Chad | last post by:
I have a problem that I am desperate to understand. It involves dynamically adding controls to a Table control that is built as a result of performing a database query. I am not looking to...
3
by: Pavan | last post by:
Hi All, I am having a wierd problem while displaying my panel. My code is something like this <table> <tr> <td width=100>label</td> <td width=100>label</td> <td width=100>label</td> <td...
2
by: jmarendo | last post by:
Hello, After reading through the "Table Basics - DOM - Refer to table cells" example at mredkj.com , I modified the code for my own purposes. In the modified version, I create a hyperlink and...
1
by: printline | last post by:
Hi' I have a problem with changing the background color in a table cell when i click on the content in the cell. Here is my code: <script type="text/javascript"> var ie = document.all...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.