1.html<form id="form1" name="form1" method="post" action="">
  <label>
  <input type="text" name="P_Name" id="P_Name" />
  </label>
  <span class="bigtitle">
  <input type="button" name="button" id="button" value="点击上传图片"  onclick="Window.open('2.html?strType=pic&inputname=P_Name',560,380,window);" />
  </span>
</form>2.html
<IFRAME id="FolderList" width="100%" height="430" frameborder="1" src="3.html"></IFRAME>3.html
<input type="text" name="str" id="str" value="ok" />
请问怎么在3.html里把str的value传递到1.html中的id="P_Name"中去呢?

解决方案 »

  1.   

    用parent,opener
    parent.opener.document.getElementById('P_Name').value='test';
      

  2.   

    3.html<input type="text" name="str" id="str" value="ok" />
    <input type="button" onclick="parent.opener.document.getElementById('P_Name').value='test';"/> 
      

  3.   

    3.html <input type="text" name="str" id="str" value="ok" />
    <input type="button" onclick="parent.opener.document.getElementById('P_Name').value=document.getElementById('str').value;"/> 
      

  4.   

    <input type="button" value="传递 abc 返回值到父窗口" onclick="opener.form1.P_Name.value='abc';window.close();">
    在你的 2.html 中加上这句话,看看能行不  我这边是可以的 一直都是这么用
      

  5.   

    opener.document.getElementById('P_Name').value='test';
      

  6.   

    你写的代码本身就有问题  Window.open打开2.html,这是一个新的页面,和1.html没什么联系了,只能说2和3有联系,你如果要上传图片,怎么不用html自带的<input type="file"> ?