Use transparent stacked addition to beautify the file upload interface (http://www.script8.com/bbs/thread.asp? Tid = 6)

Source: Internet
Author: User
Beautify the file upload interface using transparent stack Addition
I want to reply
[Magic cloud] released from 06-11-28, it 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.

◇ Test procedure->Run the following JS
<Style>
* {Font-size: 12px; cursor: Default}
. Hand {cursor: hand; cursor: pointer}
</Style>
<Body>
<Form name = FM1>
<Div id = bxattlist>
<Div id = bxatt onmouseover = "$ ('bxatt1 '). style. textdecoration = 'underline' "onmouseout =" $('bxatt1 '). style. textdecoration = ''" style = float: Left; width: 60>
<Span id = bxatt1 style = 'position: absolute; padding-top: 3; cursor: hand; font-family: '> @ add attachment </span>
<Span id = bxatt2 onmouseover = This. scrollleft = 100 style = position: absolute; width: 60; overflow: hidden; filter: alpha (opacity = 0);-moz-opacity: 0> </span>
</Div>
</Div>
</Form>
</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 text = "float: Left; margin-Right: 6; padding-top: 3; color: darkgreen"
O. innerhtml = "□" + sname +" <font onclick = $ ('bxattlist '). removechild (this. parentnode); file_repos () class = hand style = color: red; font-weight: bold> "+ Unescape (" × ") +" </font>"
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>

Start from scratch

[Dev7] Reply at 06-12-20

Pretty

Top one

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.