Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NS4 ilayer positioning

Status
Not open for further replies.

stormbind

Technical User
Mar 6, 2003
1,165
GB
Intro: layers is Netscape for the group elements including DIV, SPAN, LAYER and ILAYER. The latter element is a cross between IFRAME and DIV.

Hi,

I have a DHTML widget that works in MSIE/Mozilla. The Javascript side of it works in NS4 but I cannot prevent the ILAYER from distorting the rest of the page.

NS4 supports CSS for layers but I'm having problems getting it to respond to styles. NS4 also support inline attributes like BGCOLOR= HEIGHT= WIDTH= TOP= LEFT= though these only work with LAYER and ILAYER.

I'm trying to jog your memories ;)

Anyway.

I have a TABLE. The ILAYER should be positioned in or over one of the cells.

When that ILAYER has position:absolute, it takes up two spaces on the page, reserving the pos:relevant space but with the actual element appearing elsewhere.

When that ILAYER has position:relevant (default), it has the strange effect of making two images in the next cell disapear and although the visible part of the element is fine, the ivisible "clipped" region takes up space and distorts the page.

Does anyone know how to prevent the distortion?

The following snippet is intended for NS4 only. It will not work in MSIE/Mozilla.

Code:
<script>
var a;
if (!document.layers) document.getElementById('div').style.top=0;
function move(){

if (document.layers){
with (document){
layers.dev.moveBy(0,data.cntl.value);
layers.dev.clip.top=0-layers.dev.top;layers.dev.clip.height=100-(layers.dev.top/100);
}
} else {
document.getElementById('div').style.top=parseInt(document.getElementById('div').style.top)+parseInt(document.data.cntl.value);
}


if (document.data.cntl.value!='0') setTimeout('move()',10);
}
</script>


<body style=&quot;background-color:white;&quot;>
<br><br>


<form name=&quot;data&quot;>

<input type=&quot;button&quot; width=&quot;20&quot; value=&quot;up&quot; onblur=&quot;data.cntl.value='0';&quot; onclick=&quot;data.cntl.value='-1';move()&quot;>
<input type=&quot;button&quot; width=&quot;20&quot; value=&quot;down&quot; onblur=&quot;data.cntl.value='0';&quot; onclick=&quot;data.cntl.value='1';move()&quot;>

<input type=&quot;button&quot; name=&quot;cntl&quot; value=&quot;0&quot;>


<table bgcolor=&quot;black&quot; border=&quot;0&quot; cellpadding=&quot;1&quot;><tr><td>
<table bgcolor=&quot;white&quot; height=&quot;100&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;>


<tr>
<td width=&quot;200&quot;>reserved</td>


<td width=&quot;100&quot;><ilayer id=&quot;dev&quot; clip=100,100 bgcolor=red height=100 width=100 left=0 top=0 

src=&quot;document.html&quot;></ilayer></td>


<td width=&quot;8&quot;><input type=&quot;image&quot; height=&quot;8&quot; width=&quot;8&quot; src=&quot;scroll_up.gif&quot; onblur=&quot;data.cntl.value='0';&quot; 

onclick=&quot;data.cntl.value='-1';move()&quot; onmouseover=&quot;this.src='scroll_upH.gif'&quot; onmouseout=&quot;this.src='scroll_up.gif'&quot; 

border=&quot;0&quot;><br>
<input type=&quot;image&quot; height=&quot;8&quot; width=&quot;8&quot; src=&quot;scroll_dn.gif&quot; onblur=&quot;data.cntl.value='0';&quot; 

onclick=&quot;data.cntl.value='1';move()&quot; onmouseover=&quot;this.src='scroll_dnH.gif'&quot; onmouseout=&quot;this.src='scroll_dn.gif'&quot; border=&quot;0&quot;></td>

</tr></table>
</td></tr></table>

</form>
</body>

----------
I'm willing to trade custom scripts for... [see profile]
 
Well I fixed most of it. Still some glitches though.

No other elements are rendered after the (I)LAYER and the external document's contents appear at the bottom of the page.

I tried setting the SRC= using javascript but it had no effect. I'm sure it's possible though and that may provide a workaround. Any ideas?

----------
I'm willing to trade custom scripts for... [see profile]
 
Just a question... is it mandatiry that you try to support NS4? You've been around this forum enough to know that this version of browser is pretty much a dead horse and supports little of CSS, not to mention the bugginess that came with version 4.6.

There's always a better way. The fun is trying to find it!
 
Well yes, because multi-user commercial products die quickly if 10% of a group can't use it :)

It's OK. All fixed now, and in the end result NN4 ran rings around clunky Mozilla :)

----------
I'm willing to trade custom scripts for... [see profile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top