how to close a popup with javascript

Asked

Viewed 2,600 times

1

Good guys set up a function to open a popup, and need to put a link inside the popup to be closed. Someone knows how to do this?

My code to open the pop-up

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 so:

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

Inside the window.html file I need to put a link to close the pop-up.

1 answer

3


with this code you can close:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.