closing javascript child window
function displaymessage()
{
window.open("http://www.sabah.com.tr",开发者_高级运维"_blank")
parentWindow.close
}
How should I write instead of "parentWindow.close" to close the child page?
not 100% sure what you mean, maybe you want this:
function displaymessage() {
var win = window.open("http://www.sabah.com.tr","_blank")
win.close();
}
You need to maintain a reference to the opened window:
function displaymessage() {
var myWin = window.open("http://www.sabah.com.tr","_blank");
myWin.close();
}
..but most browsers will prompt you saying "this page is trying to close....", just be aware of that, and test various browsers to make sure you get the desired result.
精彩评论