用Js控制iframe内表单提交
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript"> function test(){ window.frames["iframe"].document.put_form.submit(); } </script> </head> <body> <a href="#" onclick="test()">点此查看</a> <iframe src="123.html" name="iframe" id="iframe"></iframe> </body> </html>
123.html里的内容是:
<form name="put_form" id="put_form" action="phpclass/put.php" method="post" enctype="multipart/form-data"> <input type="file" name="pictures[]" /> <input type="file" name="pictures[]" /> <input type="file" name="pictures[]" /> </form>
下面是子窗口如何调用父窗口的
function parWindow(){ var vid = self.parent.document.getElementById('id').innerHTML; document.getElementById('vid').value=vid; }
加到onload里面可以调用父窗口的元素