开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜