标签:hang files document javascrip for ntb put new java
<p> <label>请选择一个文件:</label> <input type="file" id="file" multiple="multiple" onchange="readAsDataURL()"/> </p> <div id="result" name="result"></div>
<script>
var result=document.getElementById("result"); var file=document.getElementById("file"); function readAsDataURL(){ var file = document.getElementById("file").files; var result=document.getElementById("result"); for(i = 0; i< file.length; i ++) { var reader = new FileReader(); reader.readAsDataURL(file[i]); reader.onload=function(e){ //多图预览 result.innerHTML = result.innerHTML + ‘<img src="‘ + this.result +‘" />‘; } } } </script>
标签:hang files document javascrip for ntb put new java
原文地址:http://www.cnblogs.com/winyh/p/7158641.html