2012年3月31日星期六

自定义按钮统一文件输入选择框

使用jquery在按钮的click事件中触发file的click ie下form.submit 拒绝访问
make-upload-input-enable-but-uneditable
click-event-fire-programmatically-for-a-file-input
create a "hidden" file input (using opacity, not "hidden" or "display: none"!) and afterwards create the button "bellow" it. In this way the button is seen but on user click it actually activates the file input.

<div style="display: block; width: 100px; height: 20px; overflow: hidden;">
<button style="width: 110px; height: 30px; position: relative; top: -5px; left: -5px;"><a href="javascript: void(0)">Upload File</a></button>
<input type="file" id="upload_input" name="upload" style="font-size: 50px; width: 120px; opacity: 0; filter:alpha(opacity: 0);  position: relative; top: -40px;; left: -20px" />
</div>


没有评论:

发表评论