473,287 Members | 1,616 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,287 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 9929
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: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.