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

Q86 How do I display a popup window when an image is clicked? Can you do this in an image map also?

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

Try this:

<script language="JavaScript"><!--
function win(fileName) {
     myFloater = window.open('','myWindow','scrollbars=no,status=no,width=300,height=300')
     myFloater.location.href = fileName;
}
//--></script>

<p><a href="javascript:win('file1.html')"><img src="test.gif" border="0" width="200" height="100"></a>

<map name="image-map">
<area shape="rect"   coords="15,15,85,85"  href="javascript:win('file1.html')">
<area shape="rect"   coords="93,15,110,85" href="javascript:win('file2.html')">
<area shape="circle" coords="150,50,35"    href="javascript:win('file3.html')">
</map>

<img name="test.gif" src="test.gif" border="0" width="200" height="100" usemap="#image-map">

©2018 Martin Webb