Changing the style of file domains is compatible with ie and firefox.

Source: Internet
Author: User

Copy codeThe Code is as follows:
<Body>
<Input type = file id = "j" onchange = "getValue ();" style = "-moz-opacity: 0; filter: alpha (opacity = 0); opacity: 0; position: absolute; left: 166px; "/>
<Input id = "ye" style = "color: green; border: 1px solid green; width: 300px;"/>
<Input type = "button" value = "File" style = "border: 1px solid green; width: 80px;"/>
</Body>

<Script language = "javascript">
Function getValue (){
Document. getElementById ('Ye '). value = document. getElementById ('J'). value;
}
</Script>

Ideas:

1. Make the stubborn file field <input type = file/> transparent: style = "-moz-opacity: 0; filter: alpha (opacity = 0); opacity: 0;"

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

3. Place the Browse button of the file domain above the button we wrote.

4. When js is used to get the value of the file field changed, that is, the obtained file path is assigned to the value of the text box, so that it is OK.

I'm just experimenting with simple styles. In fact, they can be further beautified;

This advantage: It only simulates the appearance of the file domain. In fact, the file domain file function is very convenient.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.