Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1298 How can I resize an existing layer?

irt.org | Knowledge Base | DHTML | Q1298 [ previous next ]

Q1298 How can I resize an existing layer?

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.