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

Q633 Is there a way to open up a pop up window which will constrain to the dimensions of an image and still allow you to have a title text for the popup window?

irt.org | Knowledge Base | JavaScript | Window | Q633 [ previous next ]

Q633 Is there a way to open up a pop up window which will constrain to the dimensions of an image and still allow you to have a title text for the popup window?

Only in Netscape Navigator 4 and Internet Explorer 4:

First the main window:

<SCRIPT LANGUAGE="JavaScript"><!--
function openImageWindow(imageSrc,imageTitle) { 
    fileName = 'template.htm?' + escape(imageSrc) + '&' + escape(imageTitle);
    myWindowHandle = window.open(fileName,'windowName','directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=yes');
}

openImageWindow('apicture.gif','Title');
//--></SCRIPT>

Then the template window:

<HTML>
<BODY onLoad="if (document.all || document.layers) window.resizeTo(document.images[0].width,document.images[0].height - 0 + 50)">

<SCRIPT LANGUAGE="JavaScript"><!--
var passed     = location.search ? unescape(location.search.substring(1)) + '&' : '';
var imageSrc   = passed ? passed.substring(0,passed.indexOf('&')) : 'default.gif';
passed         = passed.substring(passed.indexOf('&')+1);
var imageTitle = passed ? passed.substring(0,passed.indexOf('&')) : 'Default Title';

document.write('<H1>' + imageTitle + '</H1>');
document.write('<IMG SRC="' + imageSrc + '">');
//--></SCRIPT>

</BODY>
</HTML>

Feedback on 'Q633 Is there a way to open up a pop up window which will constrain to the dimensions of an image and still allow you to have a title text for the popup window?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


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