Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

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

You are here: irt.org | FAQ | JavaScript | Window | Q665 [ previous next ]

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>

©2018 Martin Webb