Home >Web Front-end >JS Tutorial >The idea of ​​changing the style of the file field is also compatible with ie and firefox_javascript techniques

The idea of ​​changing the style of the file field is also compatible with ie and firefox_javascript techniques

WBOY
WBOYOriginal
2016-05-16 17:19:031272browse
Copy code The code is as follows:



< ;input id="ye" style="color: green;border: 1px solid green;width:300px;" />





Idea:

1. The stubborn file field is Transparent: style="-moz-opacity:0;filter:alpha(opacity=0);opacity:0;"

2. Use A text box and button replace the appearance of the file and

3. Place the browse button of the file field above the button we wrote

4. Use js to get the value of the file field when the value changes That is: get the file path and assign it to the value of the text box, so it’s ok

I’m just experimenting, the style is very simple; in fact, it can be further beautified;

The advantage of this: it’s just a simulation Although the appearance of the file file domain is changed, what actually works is the file domain file, which is very convenient.
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