Click to See Complete Forum and Search --> : change IMAGE SIZED WINDOW script


twies
05-20-2003, 06:08 PM
Hi,

I'm a newbie with Java scripting but I installed this script from this site and it work good only I would really like it if the new window would only show the image and not all the extra 'chrome'. ( menu bar, status bar, etc)
If tried to change for some time today but I can't get it to work with this script.
Does someone know how to change this script to do this ?
Thanks in advance,
Tomas

<!-- FOUR STEPS TO INSTALL IMAGE SIZED WINDOW:

1. Insert the HEAD section into a new file, save as image-window.html
2. Add the onLoad event handler into the BODY tag of image-window.html
3. Put the last coding into the BODY section of image-window.html
4. Place the window opening code into your regular HTML page -->

<!-- STEP ONE: Paste this code into the HEAD of image-window.html -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Alan Chu -->
<!-- Web Site: http://homepage.hkpeoples.net -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
var isNav4, isIE4;
if (parseInt(navigator.appVersion.charAt(0)) >= 4) {
isNav4 = (navigator.appName == "Netscape") ? 1 : 0;
isIE4 = (navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0;
}
function fitWindowSize() {
if (isNav4) {
window.innerWidth = document.layers[0].document.images[0].width;
window.innerHeight = document.layers[0].document.images[0].height;
}
if (isIE4) {
window.resizeTo(500, 500);
width = 500 - (document.body.clientWidth - document.images[0].width);
height = 500 - (document.body.clientHeight - document.images[0].height);
window.resizeTo(width, height);
}
}
// End -->
</script>
</HEAD>

<!-- STEP TWO: Insert the onLoad event handler to image-window.html -->

<BODY onLoad="fitWindowSize()">

<!-- STEP THREE: Copy this code into the BODY of image-window.html -->

<div style="position:absolute; left:0px; top:0px">
<img src="image.gif" alt="JSS Logo" width="267" height="103">
</div>

<!-- STEP FOUR: Paste this code into your window opening page -->

<a href="image-window.html" target="_blank">Open Image Window</a>

<p><center>
<font face="arial, helvetica" SIZE="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size: 1.59 KB -->

Jona
05-20-2003, 06:23 PM
Taking off the title bar, menubar, etc., will have to be done from the opener. Post the code from the page that opens this window. To remove the scroll bar use this:


<body onload="fitWindowSize();" style="overflow:none;">

twies
05-21-2003, 03:13 AM
Hi Jona,

I've posted all the code. ( see instructions with the script)
the code that opens the page is:

<a href="image-window.html" target="_blank">Open Image Window</a>

So how do I combine that with your line ?

Jona
05-21-2003, 01:12 PM
Ok, use this as your link (will work for non-Javascript users as well but they will see the scrollbars etc).


<a href="image-window.html" target="imgWin" onClick="window.open('image-window.html','imgWin','scrollbars=no,menubar=no,height=500,width=500,history=no');">Open Image</a>

pyro
05-21-2003, 01:29 PM
You could use this script: http://www.infinitypages.com/research/imagepopup.htm

Jona
05-21-2003, 01:31 PM
That's true. lol

twies
05-23-2003, 10:51 AM
thanks for all the replies.
But I really couldn't get both scripts to work without 'chrome'
even on an new page without any other code.
Maby it is the browser I use ? IE6 with SP1
I've now just used the 'open browser window' behavior within dreamweaver 4 and then it does work. together with an extension I even got it it look nice and damned autoclose working! although this only works for the links to images )
here is the result
http://www.microrental.nl/html/prijsinfo.html

Thanks anyway
Cheers,
Tomas