父页面通过window.open打开的子页面
father.html
<input type="" name="main" id="mmm" value="123" /><script type="text/javascript"> $('#Btn').on('click',function(){ window.open('son.html'); });</script>
son.html
<script type="text/javascript"> alert(window.opener.document.getElementById('mmm').value); </script>
控制台
Uncaught TypeError: Cannot read property 'value' of null at son.html:21
相关分类