I think it is an easy questions but I am new in JavaScript
Why button "but2" not work when I try close a new window?
HTML code
<input type="button" value="New window" id="but1" onclick="createwin()" />
<input type="button" value="close window" id="but2" onclick="closewin()" />
JavaScript code
function createwin(){
var win1 = window.open('http://www.google.com','google','width=500,height=500');
}
function closewin(){
win1.close();
}