开发者

javascript open parent window

开发者 https://www.devze.com 2023-03-28 20:55 出处:网络
The following is in the NewForm.aspx which gets executed from a parent page (surveys/lists/testsurvey/allitems.aspx). The javascript works and open google. However, it opens the google in the pop up w

The following is in the NewForm.aspx which gets executed from a parent page (surveys/lists/testsurvey/allitems.aspx). The javascript works and open google. However, it opens the google in the pop up window (newform.aspx) but i need to close the popup window and show google.com on the parent window (or whatever the parent window link is)

<script type="text/javascript">
function redirect()
{
  var inputcCtrls = document.getElementsByTagName("input");
  for(m=0; m<inputcCtrls.length; m++)
  开发者_JAVA百科 {
       if(inputcCtrls[m].type == 'button' && inputcCtrls[m].value == 'Finish')
        {
               var funcOnClick = inputcCtrls[m].onclick;
               inputcCtrls[m].onclick = function () { window.location = "http://www.google.com/" };        }
   }
}

redirect();
</script>


Use the opener property to find the window that opened the current window:

window.opener.location = "http://www.google.com/";
window.close();
0

精彩评论

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

关注公众号