惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Webroot Blog
Webroot Blog
U
Unit 42
A
About on SuperTechFans
宝玉的分享
宝玉的分享
月光博客
月光博客
C
CERT Recently Published Vulnerability Notes
P
Privacy International News Feed
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
P
Privacy & Cybersecurity Law Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
S
Securelist
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Spread Privacy
Spread Privacy
L
Lohrmann on Cybersecurity
Apple Machine Learning Research
Apple Machine Learning Research
K
Kaspersky official blog
Hugging Face - Blog
Hugging Face - Blog
B
Blog
I
Intezer
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
V
V2EX
L
LangChain Blog
AI
AI
G
GRAHAM CLULEY
T
Tor Project blog
人人都是产品经理
人人都是产品经理
D
Docker
WordPress大学
WordPress大学
Google DeepMind News
Google DeepMind News
I
InfoQ
Y
Y Combinator Blog
C
Comments on: Blog
GbyAI
GbyAI
www.infosecurity-magazine.com
www.infosecurity-magazine.com
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
腾讯CDC
N
News and Events Feed by Topic
MyScale Blog
MyScale Blog
H
Help Net Security
Vercel News
Vercel News
T
Tenable Blog
博客园 - 三生石上(FineUI控件)
爱范儿
爱范儿

博客园 - 温温恭人

[导入]:创建单色画笔 (Visual C#) [导入]在运行时创建位图 (Visual C#) [导入]创建笔 (Visual C#) [导入]。net图形操作(MSDN) [导入]如何动态生成table(javascript) [导入]javascript分页 [导入]贡献一个新浪的幻灯片(javascript) [导入]解析XML并生成表格 [导入]css控制div居中 [导入]精典的一句 [导入]通过简易的前台代码实现无限二级域名转向(来自无忧 biyuan老矣) [导入]巧妙的让web来执行“计划任务”(转 biyuan老矣 ) [导入]由浅到深了解JavaScript类 - 温温恭人 [导入]DHTML中重要的属性方法 - 温温恭人 [导入](转贴)正则表达式学习心得体会(5) [导入](转贴)正则表达式学习心得体会(4) [导入]正则表达式学习心得体会(3)(转) [导入]正则表达式学习心得体会(2) [导入](转贴)正则表达式学习心得体会(1) - 温温恭人 [导入]用Javascript实现interface的类似功能 [导入]javascript总结 [导入]将程序集链接到 Word 或 Excel 文件 [导入]input高级限制级用法 [导入] js实现的动态多文件上传 (来自http://cms.bmw.net.cn) [导入]js用FileSystemObject 对象实现文件控制
[导入]使用透明叠加法美化文件上传界面 (http://www.script8.com/bbs/thread.asp?tid=6)
温温恭人 · 2007-06-19 · via 博客园 - 温温恭人

【幻宇】于06-11-28 09:58 发布

    估计很多人都对文件域那难看的样式无可奈何,对于一个讲究完美的web系统来说,这种界面是无法接受的。gmail的附件添加在IE浏览器中实现了样式自定义,让大伙兴奋了好一这,他使用的是文件域的click()方法,但客户端的安全限制非常苛刻,必须结合iframe才能实现,代码比较繁锁。我使用的是透明叠加法,即把文件域置于点击目标之上,并让其透明,这样用户看到的是自定义热区,点击的依然是浏览按钮,没有违反任何安全机制。同样地,这种方法也支持firefox。

◇ 测试程序 - >> 运行下面的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:宋体'>@添加附件</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.cssText="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>


实事求是,从头开始

文章来源:http://www.cnblogs.com/suiqirui19872005/archive/2007/06/12/780986.html