Popup window

Hi. Today is the first day that I read about window object and specifically about creating popup windows. The code below produces a popup window when a link is clicked:

var Survey = 
	init: function()
		var surveyLink = document.getElementById("survey");
		Core.addEventListener(surveyLink, "click", Survey.clickListener);

	clickListener: function(event)
		var surveyWin = Survey.makePopup(this.getAttribute("href"), 300, 300, "resize");
		return surveyWin;
	makePopup: function(url, width, height, overflow)
		if (width > 640)
			width = 640;
		if (height > 480)
			height = 480;
		if (overflow == "" || !/^(resize|scroll|both)$/.test(overflow))
			overflow = "both";
		var scrollbar = (/^(scroll|both)$/.test(overflow) ? "yes" : "no");
		var resizable = (/^(resize|both)$/.test(overflow) ? "yes" : "no");
		var win = window.open(url, "", 'width='+ width +',height='+ height +',scrollbars='+ scrollbar +',resizable='+ resizable +',status=yes,location=no,toolbar=no,menubar=no');
		return win;



<a id="survey" title="Take survey now." href="survey.html">Take survey</a>


    	<form method="post" action="#">
            	New design of siteName is:
            <input type="radio" id="great" name="design" value="great" />
            <label for="great">Great</label>
            <br />
            <input type="radio" id="okay" name="design" value="okay" />
            <label for="okay">Okay</label>
            <br />
            <input type="radio" id="ugly" name="design" value="ugly" />
            <label for="ugly">Ugly</label>
            	<input type="submit" value="Submit" />

I would like to add a “Close Window” button on survey.html page and when that button is clicked, the window would close. How do I do that? I know that I should use (reference to popup window).close(), but how and where do I attach even listener to that button?


Question is off the table :slight_smile: