Click to See Complete Forum and Search --> : How to: close.window using image map
mdanan
01-24-2003, 03:23 PM
Can someone tell me how to close a pop-up window using image map?
Here's my code and it's not working.
<map name="map">
<area shape="rect" coords="258,6,345,23" href="javascript:window.close();">
</map>
Do I need to set up a reference code for window.close in the head tag?
BestZest
01-24-2003, 03:38 PM
I've answered something similar before...
When you open the window use: win=window.open()
To close that window use win.close()
BestZest
mdanan
01-24-2003, 04:43 PM
I tried using your code with the image map as I've asked but it wouldn't work. So I re-wrote it in a simpler way instead BUT...
<head>
<script language="javascript">
<!--
function win()
{
win=window.close
}
// -->
</script>
</head>
<body>
<a href="javascript:win();">
<img src="close.jpg">
</a>
</body>
...it requires me to click on the image twice before the window would close.
Please help....
And does anybody else know how to make it work in an image map?
BestZest
01-27-2003, 02:21 PM
First, is this code IN the pop-up window, or OUT of the pop-up window.
If it is IN:
use: this.window.close()
If it is out, the code I put before should work, just make the function different from the varible, like: closeWin() and win=window.close()
BestZest