参考网址:http://www.alleyloft.com/contents/share?id=14
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>demo</title>
<style>
*{margin: 0;padding: 0;}
.box{
position:relative;
float:left;
overflow:hidden;
}
input.uploadFile{
position:absolute;
right:0px;
top:0px;
opacity:0;
filter:alpha(opacity=0);
cursor:pointer;
width:276px;
height:36px;
overflow: hidden;
}
a.link{
float:left;
display:inline-block;
padding:4px 16px;
color:#fff;
font:14px "Microsoft YaHei", Verdana, Geneva, sans-serif;
cursor:pointer;
line-height:28px;
text-decoration:none;
}
</style>
</head>
<body>
<div class="box">
<a href="javascript:;" class="link">浏览</a>
<input ty pe="file" class="uploadFile" onchange="getFile(this,‘copyFile‘)">
</div>
</body>
</html>