现在的位置: 首页 > 综合 > 正文

模拟GMail添加附件的代码

2012年12月04日 ⁄ 综合 ⁄ 共 497字 ⁄ 字号 评论关闭
<html>
<head>
<title>browser</title>
<script type="text/javascript">
<!--
function browser(){
    var t=document.createElement('input');
    t.setAttribute('id','temp_file');
    t.setAttribute('type','file');
    t.style.display='none';
    t.onchange=function(){document.getElementById('fileloc').innerHTML=t.value;document.body.removeChild(t);};
    document.body.appendChild(t);
    t.click();
}
//-->
</script>
</head>
<body>
<div id="fileloc"></div><a href="#" onclick="browser();return false;">browser...</a>
</body>
</html>

抱歉!评论已关闭.