how to close a popup with javascript

1

Well, I've put up a function to open a popup, and I need to put a link inside the popup to close it. Does anyone know how to do this?

My code to open the popup

function popup(URL) {
var width = 1024;
var height = 700;
var left = 30;
var top = 50;
window.open(URL, 'janela', 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left + ', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');

}

I call the link like this:

<a onclick="javascript:popup('janela.html')">Link</a>

Inside the window.html file I need to put a link to close the popup.

    
asked by anonymous 13.02.2017 / 12:00

1 answer

3

With this code you can close:

<a href='#' onclick='window.close()'>Fechar modal</a>
    
13.02.2017 / 12:04