Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1298 How can I resize an existing layer?

You are here: irt.org | FAQ | DHTML | Q1298 [ previous next ]

In Netscape Navigator 4.x you can't resize the layer by adjusting the width or height attributes. You could use the resizeTo or resizeBy methods, but this appears just to clip the layer, it doesn't re-render the text within the layer.

What you can do is use the load method to load another page into the layer, *and* at the same time give the layer a new width

<html>
<head>
<script language="JavaScript"><!--
function myResize(o,x,y) {
    if (document.all) {
        document.all[o].style.width=x;
        document.all[o].style.heigth=y;
    }
    else if (document.layers) {
        document.layers[o].load('test.htm',x);
    }
}
//--></script>
</head>

<body onLoad="myResize('myLayer',100,200)">

<span name="myLayer" style="position:absolute">
original content in here
</span>

</body>
</html>

©2018 Martin Webb