标签:lower type=file inpu tar doc cas html 判断 ons
HTML:
<div class="zheng"> <img src="../img/idcard_face.png" alt="" class="imgs"/> <input type="file" class="typeCard typeCard1"/> </div>
Js:
1 $(".typeCard1").change(function(){ 2 var file = this.files[0]; 3 if (window.FileReader) { 4 var reader = new FileReader(); 5 reader.readAsDataURL(file); 6 reader.onloadend = function (e) { 7 $(".imgs").attr("src",e.target.result); 8 console.log( $(".imgs").attr("src")) 9 }; 10 } 11 });
判断上传文件格式:
1 var filePath=document.getElementById("xsp").value; 2 var fileType=filePath.substr(filePath.lastIndexOf("\.")).toLowerCase();
标签:lower type=file inpu tar doc cas html 判断 ons
原文地址:https://www.cnblogs.com/hermitks/p/9673382.html