读书人

iframe和父页面直接如何传值

发布时间: 2012-07-05 07:59:18 作者: rapoo

iframe和父页面直接怎么传值?
iframe和父页面直接怎么传值?
只需要兼容firefox,ie不管


[解决办法]
父页面。。

HTML code
<!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> 

读书人网 >JavaScript

热点推荐