在javascript中打开文件对话框 [英] open file dialog box in javascript

查看:173
本文介绍了在javascript中打开文件对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个解决方案,在html中显示打开的文件对话框,同时点击一个div。打开文件对话框必须在div被点击时打开。

i need a solution to display open file dialog in html while clicking a div . the open file dialog box must open when the div is clicked.

注意:我不想将输入文件对话框显示为html的一部分页。它必须在javascript中显示为 alert

note : i dont want to display the input file dialog as part of html page. it must be displayed as alert in javascript.

[点击div时,我需要打开文件对话框。它必须像警报一样不属于网页]

[i need open file dialog box when a div is clicked. it must be as like alert which is not part of the web page]

推荐答案

这是一个很好的一个

精细上传程式演示

它是一个< input type ='file'/> 控制本身。但是一个div被放在那个,并且css样式被应用来获得这种感觉。文件控制的不透明度设置为0,以便在点击div时显示对话框窗口。

It is an <input type='file' /> control itself. But a div is placed over that and css styles are applied to get that feel. Opacity of the file control is set to 0 so that it appears that the dialog window is opened when clicking on the div.

这篇关于在javascript中打开文件对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆