日期:2014-05-16 浏览次数:20330 次
<input id="fileElement" type="file" name="filename" size="33" style="opacity: 0; ">
<span class="filename"></span>
<span class="action">选择文件</span>
<input id="fileElement" type="file" name="filename" size="33" style="opacity: 0; ">
<span class="filename"></span>
<span class="action">选择文件</span>
<script>
$(function(){
$("#fileElement").after('<span class="filename"></span><span class="action">选择文件</span>');
});
</script>
<html>
<head>
</head>
<body>
<div>
<input id="fileElement" type="file" name="filename" size="33" style="opacity: 0; ">
</div>
<script type="text/javascript">
var file = document.getElementById('fileElement').parentNode;
var span1 = document.createElement('span');
span1.setAttribute('class','filename');
file.appendChild(span1);
var span2 = document.createElement('span');
span2.setAttribute('class','action');
span2.innerHTML= '选择文件';
file.appendChild(span2);
</script>
</body>
</html>