<!-- 父页面中的上传按钮 --> <img src="ui/images/myimg.png" class="link" onclick="upload()" /> <iframe src="upload.php"id="box_paint_container" ></iframe> upload.php 文件中有一个表单 <form enctype="multipart/form-data" action="upload.php"id="forms" method="post" name="upform" style="position: relative; "> <input name="upfile" type="file"id="file" onchange="document.getElementById('forms').submit(); window.parent.document.getElementById('box_paint_container').style.display='none';;"> </form> 下面是父页面中的一个函数 <script type="text/javascript"> function upload(){ var a = document.getElementById('box_paint_container').contentWindow.document.getElementById("file"); a.click(); } </script>