2013-07-24 187 views
0

当您点击打印笔记时,我期待另一个窗口弹出您记录的笔记。在我的情况下,它一直显示空白。从父页面获取内容

请让我知道我是否应该提供更多的细节:

页(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)

<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> 
+0

jQuery在哪里? index.html是否被称为空白? – putvande

+0

你并不是真的打开一个新窗口,而是一个'_blank',它不一样。 – adeneo

+0

这正是我想要做的,似乎也没有工作。 http://fellowshipdallas.org/media/player/media/what-we-should-know-about-the-end-times/video/ – user2608501

回答

0

我得到了它,我的上述代码的工作就好了,是事实,我的链接不包含在HTTP而是文件。它不会工作,除非你有http,所以它不会在你的本地服务器上工作。

谢谢大家的帮助。