Javascript 从父页面获取内容

Javascript 从父页面获取内容,javascript,parent-child,Javascript,Parent Child,当你点击打印便笺时,我期待着另一个窗口会弹出你所做的便笺。在我的情况下,它一直显示为空白 请告知我是否需要提供更多详细信息: 带有文本区域的第(1)页 <textarea id="sermon_notes" cols="5" rows="5"></textarea> <a href="../notes/print/forgiveness/index.html" target="_blank" class="btn_small_cmg"> <spa

当你点击打印便笺时,我期待着另一个窗口会弹出你所做的便笺。在我的情况下,它一直显示为空白

请告知我是否需要提供更多详细信息:

带有文本区域的第(1)页

<textarea id="sermon_notes" cols="5" rows="5"></textarea>
<a href="../notes/print/forgiveness/index.html" target="_blank" class="btn_small_cmg">     <span>Print Notes</span></a>

第(2)页,javascript试图提取您在第(1)页上编写的信息,以便它可以显示在第(2)页上


媒体新基金会基督教部
笔记
一些文本
吃了



我的笔记: //从父页面获取注释 var message_notes=window.opener.document.getElementById('sermon_notes').value; //将新行字符替换为
message_notes=message_notes.replace(新的RegExp(“\\n”,“g”),“
”; 文件编写(信息注释);


我明白了,我上面的代码工作得很好,因为我的链接不包含http,而是包含文件。除非您有http,否则它不会工作,因此它不会在您的本地服务器上工作


谢谢大家的帮助

jQuery在哪里?你调用的index.html是空白的吗?你并不是真的在打开一个新窗口,而是一个
\u blank
,这是不一样的。这正是我想做的,似乎也不起作用。尝试使用
window.open()
我会使用一个表单并通过POST发送信息
<html>
  <head>
    <title>Media | New Foundation Christian Ministries </title>

       <link rel="stylesheet" href="../css/popout.css" media="screen" type="text/css" />
       <link rel="stylesheet" href="../css/print.css" media="print" type="text/css" />

    </head>

    <body class="about">
      <div class="wrap">
  <div class="header">
    <a href="javaScript:window.print();" class="print"><span>Print</span></a>
    <h1><img src="../images/logo.png" alt="New Foundation Christian Ministries" />       </h1>
</div>
<div class="content">
        <div class="page_header">
        <h2>Notes</h2>
    </div>
    <h1></h1>
        <h1>some text</h1>
        <small>ate</small>

        <br/><br/><br/>


            <h3>My Notes:</h3>
            <p>

            <script type="text/javascript">
                // Get the notes from the parent page
                var message_notes = window.opener.document.getElementById('sermon_notes').value;
                // Replace out the new line character with a <br>
                message_notes = message_notes.replace(new RegExp( "\\n", "g" ),"<br />");
                document.write(message_notes);
            </script>
            </p> 

</div>
<div class="footer">

   </div>
</div>
</body>
</html>