单击图像/按钮时如何触发文件浏览

时间:2011-01-27 12:54:27

标签: php javascript html

当我点击自定义按钮时,我想触发浏览器文件上传窗口。它应该在图像中显示如下所示。enter image description here

1 个答案:

答案 0 :(得分:4)

看看这里:Custom file input can’t be that hard?

或者您可以尝试这样的事情:

<div style='width:140px;margin-top:80px;position:relative;'>
    <div style='position:absolute; cursor:pointer; cursor:hand; width:140px; height:20px; background:#3172a0; border-top:solid 1px #a2a2a2; color:#fff;padding-top:4px;' align='center'>Browse...</div>
        <input name='image' type='file' size='5' style='position:absolute; cursor:pointer; cursor:hand; height:25px; opacity:0.01; filter:alpha(opacity=0); top:0px; left:0px;' />
    </div>
</div>
相关问题