<!-- 父頁面中的上傳按鈕 -->
<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>