Home  >  Article  >  Web Front-end  >  改变文件域的样式实现思路同时兼容ie、firefox_javascript技巧

改变文件域的样式实现思路同时兼容ie、firefox_javascript技巧

WBOY
WBOYOriginal
2016-05-16 17:19:031230browse
复制代码 代码如下:









思路:

1、把顽固的文件域就是 透明化:style="-moz-opacity:0;filter:alpha(opacity=0);opacity:0;"

2、用一个文本框和按钮代替文件与的外观

3、将文件域的浏览按钮放到我们写的按钮的上方

4、用js得到文件域value改变时的值即:得到的文件路径,并赋给文本框的value,这样就ok了

我只是试验,样式很简陋;其实可以进一步美化;

这样的好处:只是模拟了file文件域的外观,其实起作用的还是文件域file,这样就很方便。
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn