javascript/jquery-隐藏从弹出窗口控制的父选项卡中的元素第2部分

javascript/jquery-隐藏从弹出窗口控制的父选项卡中的元素第2部分,javascript,jquery,popup,parent,Javascript,Jquery,Popup,Parent,有人能帮我吗? 我有一个父窗口和一个弹出窗口。我想让他们交流,但代码有问题。请建议我使用javascript或jquery。我只是希望弹出窗口也能控制父窗口 My index.html <html> <head> <script> function openwindow() { window.open("pop.html","mywindow","menubar=1,resizable=1,width=400,height=400"); } </scri

有人能帮我吗? 我有一个父窗口和一个弹出窗口。我想让他们交流,但代码有问题。请建议我使用javascript或jquery。我只是希望弹出窗口也能控制父窗口

My index.html

<html>
<head>
<script>
function openwindow() { window.open("pop.html","mywindow","menubar=1,resizable=1,width=400,height=400"); }
</script>
</head>
<body>
<a href="href="javascript: openwindow()"" id="will-hide-in-pop">Show pop up!</a>
</body>
</html>

函数openwindow(){window.open(“pop.html”、“mywindow”、“menubar=1,resizeable=1,width=400,height=400”);}
然后单击锚定后,将显示pop。以下是带有表单的弹出代码: 弹出代码:

<html>
<head>
<script>
function clicked(){window.opener.document.getElementById('will-hide-in-pop').style.display="none"; }
</script>
</head>
<body>
<div>
<form action="process.php" method="GET">
<input type="text" name="text" />
<input type="checkbox" name="cbox" />
<input type="submit" name="" onclick="clicked()"/>
</form>
</div>
</body>
</html>

函数clicked(){window.opener.document.getElementById('will-hide-in-pop').style.display=“none”}
我的密码写对了吗? 我只是想要它,如果表单被提交,父窗口中的锚也将消失


请帮助我

尝试在jQuery submit中调用您的函数:

 $(document).ready(function () {
     $('form').submit(function () {
         clicked();             
      });       
 });

注意选择器:.getElementById('will-hide-in-pop')在弹出窗口中,您使用getElementById,但在索引中,有class=“will-hide-in-pop”