I'm strictly concerned with IE, so cross-browser compatibilty isn't
necessary. If you view the code below, I almost get exactly what I'm
looking for:
- A table of four cells that expands/contracts to the width of the
browser window. When it contracts, the cell never gets smaller (in
width) than the largest DIV item.
- When the DIV elements dynamically change, the table cells remain
the same in width (and as a result, the left positioning of the text
doesn't change on each dynamic DIV change).
But, here's my problem:
- The first DIV element appears on top, and the second appears below
when made visible (I'd like the top and left positioning of the
dynamic elements to appear in the same spot, based on where that is
per the table cell/browser window size.
- If I use absolute positioning, the table cell is still drawn larger
(in height) because it assumes the second line of the hidden DIV.
Although I've asked for a "DIV without line breaks" solution, now that
I think of it, that last bullet-point might still pose a problem.
Can anyone please help? I'd prefer to solve this through straight
HTML/CSS rather than some gimmicky JavaScript solution whereby I detect
the top-left attributes of items, then move the second DIV to that
location.
I apologize if I've done a poor job of explaining what I'm trying to
accomplish. Thanks in advance for any help you can offer me.
----------------------------------------------------------
<html>
<head>
<title>Header Work</title>
<script language="JavaScript">
var incArray = new Array (0,0,0,0);
function sfs (num) {
var a = document.getElementById(num+"a");
var b = document.getElementById(num+"b");
if (incArray[num]%2==1) {
a.style.visibility = "hidden";
b.style.visibility = "visible";
} else {
b.style.visibility = "hidden";
a.style.visibility = "visible";
}
++incArray[num];
}
</script>
</head>
<body>
<table border=1 cellpadding=0 cellspacing=0 width=100%>
<tr>
<td nowrap>
<div id="0a"
style="visibility:hidden;">xxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</div>
<div id="0b" style="visibility:visible;">aaaaaaaa</div>
</td>
<td nowrap>
<div id="1a" style="visibility:hidden;">cccccccc</div>
<div id="1b" style="visibility:visible;">aaaa</div>
</td>
<td nowrap>
<div id="2a" style="visibility:hidden;">##########</div>
<div id="2b" style="visibility:visible;">2</div>
</td>
<td nowrap>
<div id="3a" style="visibility:hidden;">cdcd</div>
<div id="3b"
style="visibility:visible;">aaaaaaaaawwwwwwwwwwwww waaaa</div>
</td>
</tr>
</table>
<a href="javascript
:sfs(0);">Switch 1st space</a><BR>
<a href="javascript
:sfs(1);">Switch 2nd space</a><BR>
<a href="javascript
:sfs(2);">Switch 3rd space</a><BR>
<a href="javascript
:sfs(3);">Switch 4th space</a>
</body>
</html>
--
Johnny Two Dogs
------------------------------------------------------------------------
Johnny Two Dogs's Profile:
http://www.highdots.com/forums/member.php?userid=316
View this thread:
http://www.highdots.com/forums/showthread.php?t=1543511