Beautifying the file upload interface using transparent stack addition _ form special effects

Source: Internet
Author: User
Using transparent stack addition to beautify the file upload interface is estimated that many people are helpless about the ugly style of the file domain. For a perfect web system, this interface is unacceptable. Gmail attachments are added to IE browsers to implement style customization, which makes everyone very excited. They use the click () method of the file domain, but the client's security restrictions are extremely demanding, only iframe can be used together, and the code is more complex. I am using transparent stack addition, that is, place the file domain on the top of the click target and make it transparent. In this way, the user can see the custom hot zone and click the Browse button, no violation of any security mechanism. Similarly, this method also supports firefox.

<Style> * {font-size: 12px; cursor: default }. hand {cursor: hand; cursor: pointer} </style> <body> </body> script file_create () function file_create () {$ ("bxAtt2 "). innerHTML = "<input onchange = file_change (this) hidefocus type = file name = file1 size = 1 class = hand>"} function file_change (tx) {var sName, o sName = tx. value. replace (// \/g ,"/"). replace (/(. *\/)(. *)/, "$2") o = document. createElement ("nobr") o.style.css Te Xt = "float: left; margin-right: 6; padding-top: 3; color: darkgreen" o. innerHTML = "□" + sName +" "+ unescape (" × ") +" "tx. style. display = "none" o. appendChild (tx) $ ("bxAttList "). insertBefore (o, $ ("bxAtt") file_repos () file_create ()} function file_repos () {$ ("bxAttList "). appendChild ($ ("bxAtt")} function $ (obj) {return typeof (obj) = "object "? Obj: document. getElementById (obj)} script
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

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.