日期:2014-05-16 浏览次数:20428 次
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title> new document </title>
</head>
<body>
<input type="file" id="aaa" style="display:none;" />
<button onclick="test()"><div id="importfile">导入</div></button> 
<script type="text/javascript">
function test() {
    var f = document.getElementById("aaa");
        f.click();
}
</script>
</body>
</html>
------解决方案--------------------
呵呵,这方法应该是这样的:把<input type="file">绝对定位在div之上(设置大小与你需要点击的一样大),然后设置input的通明度为0即可!