Closing pop up browser window

Closing pop up browser window

Post by jtousignan » Sun, 23 Oct 2005 06:35:01

using the Dreamweaver 8 behaviors panel I linked an image to a pop up window.
I want to create a link on the pop up page that says "close" and when clicked
closes that window. Does anyone know what javascript to add to achieve this.
Does the script get added to the page with the linked image or does it get
added to the page that pops up (note: the page that pops up is an actual html
page... not just an image.)


Closing pop up browser window

Post by NeilPeartR » Sun, 23 Oct 2005 07:02:00

here s the code for a pop up that I did ( a while ago) - toward the bottom is
the javascript for Close window

<link rel="stylesheet" href="/css/st_default.css" type="text/css">
<title>Bizillion Magazine Cover</title>
<script language="JavaScript1.2">
function Redirect(newsUrl) {
self.opener.location.href = newsUrl;

function ResizeWindow(imageWidth,imageHeight) {
var windowWidth = ToInt(imageWidth) + 60;
var windowHeight = ToInt(imageHeight) + 140;

var availableWidth = screen.availWidth;
var availableHeight = screen.availHeight;

var windowLeft = ((availableWidth - windowWidth) / 2);
var windowTop = ((availableHeight - windowHeight) / 2);



function ToInt (string) {
return (string > 0 ? Math.floor(string) : Math.ceil (string) );

function PopUp(url, something, data) {
var windownow
windownow =,"something",data);

function MM_callJS(jsStr) { //v2.0
return eval(jsStr)
<script type="text/javascript"
<script type="text/javascript"
<script type="text/javascript"
<script type="text/javascript"
<script type="text/javascript"

<body onLoad="ResizeWindow('400','525');" bgcolor="#ffffff" link="#000080">


<table cellpadding="0" cellspacing="0" height="100%" width="100%">
<tr valign="middle">
<td align="center">
<table cellspacing="0" cellpadding="0" border="0" width="392">
<tr valign="top">
<td width="392"><img class="pic" height="500"
src="images/OCTCoverLg.jpg" width="392"></td>

<tr valign="top">
<td height="18"><a href="javascript:window.close()">Close</a></td>





Closing pop up browser window

Post by Baxte » Sun, 23 Oct 2005 07:04:55

Put this where you want to close the window.
<a href="javascript:window.close();">Close Window</a>


Closing pop up browser window

Post by jtousignan » Sun, 23 Oct 2005 07:33:38

So you have to put anything in the head section for the script to work?

Closing pop up browser window

Post by Lars Forsl » Sun, 23 Oct 2005 16:34:02

No, it's as easy as that.
"jtousignant" < XXXX@XXXXX.COM > skrev i meddelandet