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

Q665 Can I create a window, and on the fly write code to it to display a named image and a close button?

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

Q665 Can I create a window, and on the fly write code to it to display a named image and a close button?

Try:

<SCRIPT LANGUAGE="JavaScript"><!--
imagename = '';
function enlrge(imgnme) {
    lrgewin = window.open("about:blank","","height=200,width=400")
    imagename = imgnme;
    setTimeout('update()',500)
}

function update() {
    doc = lrgewin.document;
    doc.open('text/html');
    doc.write('<HTML><HEAD><TITLE>Enlarged Image<\/TITLE><\/HEAD><BODY bgcolor="white">');
    doc.write('<IMG SRC="' + imagename + '">');
    doc.write('<form name="viewn"><input type="button" value="Close Window" onClick="self.close()"><\/form><\/BODY><\/HTML>');
    doc.close();
}

enlrge('test.gif');
//--></SCRIPT>

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.