Your win
variable is scoped to the function that handles the click event. Put it in a scope shared by both that function and closeit
.
In this case, that would probably look like:
var win;
…
$('#click').click(function() {
win = window.open("test3.html", "something", "width=550,height=170");
});
});
function closeit() {
win.close();
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…