日期:2014-05-16  浏览次数:20305 次

点击一个按钮,触发iframe里的一个上传按钮的onclick事件弹出选择文件对话框
A.htm页面的代码:

<input   type= "button "   onclick= "upimgs.getElementsByName( 'file ').item(0).click(); ">
<iframe   ID= "upimgs "   src= "B.htm "   frameborder= "0 "   scrolling= "no "   width= "100% "   HEIGHT= "25 "> </iframe>

B.htm页面的代码:

<input   type= "file "   name= "file ">

我现在想在A页面点击button弹出B页面的选择文件列表框,请大大门看下如何实现

------解决方案--------------------
不可~
安全性限制
------解决方案--------------------
只有IE可以,其他浏览器不行
<iframe name= "iframe1 " src= "1.htm "> </iframe>
<script language=javascript defer>
function show()
{
iframe1.document.getElementById( "file1 ").click()
}
</script>
<input name= "haha " type= "button " onclick=show()>
------解决方案--------------------
这样做没什么意义
------解决方案--------------------
<input type= "button " onclick= "frames[ "upimgs "].document.getElementsByName( 'file ')[0].click(); ">