本帖最后由 mingfish2 于 2012-06-25 15:24:07 编辑

解决方案 »

  1.   

    window.frames['child'].document.getElementById('str').value = document.getElementById('str').value;
      

  2.   

    window.frames['child'].document.getElementById('str').value = document.getElementById('str').value;
    firebug错误信息:
    TypeError: window.frames.child is undefined改为
    document.getElementById("child").document.getElementById('str').value = document.getElementById('str').value;
    firebug错误信息:
    document.getElementById("child").document is undefined
      

  3.   

    要你放到 window.onload 里头 或者 页面后尾 啊  大师的方法没错滴
      

  4.   

    父页面。。<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script>
            function send() {
                window.frames['child'].document.getElementById('str').value = document.getElementById('str').value;
            }
        </script>
    </head>
    <body>
    <input type='text' name='str' id='str' />
    <button onclick='send()' >send the input value</button>
    <iframe name='child' src='child.htm'></iframe>
    </body>
    </html>child页面<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
    </head>
    <body>
    <input type='text' name='str' id='str' />
    </body>
    </html>
    没什么问题啊
      

  5.   

    谢谢大师,原来我写漏了iframe的name属性