At 12:49 AM 11/03/2003 +0000, Niall O Broin wrote:
>For other browsers, I pass window sizes from the server. However, these are
>only approximations, and can result in my having windows with scrollbars,
>which is exactly what I want to avoid. Is there some nifty DOM based way of
>doing something like this for current browsers ?
I'm sure Adams code works just fine, but seeing as you asked for a more
DOM-based way of doing it, I'll offer the following script. Tested on IE5
and Phoenix 0.5 (both on w2k).
<body onLoad="doTheResize()">
<img src="file:///g:/2001_01.jpg" id="sampleImage" width="319" height="467"
border="0" alt="">
<script language="javascript" type="text/javascript">
<!--
function doTheResize() {
if (document.getElementById) {
if (document.images) {
// doesnt work for some reason - i haven't the time to investigate
// img = document.getElementById("sampleImage");
// var myHeight = img.getAttribute('height');
// var myWidth = img.getAttribute('width');
img = document.images["sampleImage"];
var myHeight = img.height;
var myWidth = img.width;
if (window.resizeTo) {
window.resizeTo(myWidth + 50, myHeight + 50);
} else {
alert("window.resizeTo not supported");
}
} else {
alert("document.images not supported");
}
} else {
alert("document.getElementById not supported");
}
}
// -->
</script>
</body>
Lee Hosty -x- hostyle AT csn.ul.ie -x- +353 (0)86 8768780
--
YONKERS (n.)
(Rare.) The combined thrill of pain and shame when being caught in public
plucking your nostril-hairs and stuffing them into your side-pocket.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!