标签:else turn input user put agent index firefox ntb
<input id="sfz_shouchi" name="sfz_shouchi" type="file" onchange="preImg(this.id,‘sfz_shouchi_img‘);" accept="image/*" required="">
<script language="javascript"> function getFileUrl(sourceId) { var url; if (navigator.userAgent.indexOf("MSIE") >= 1) { // IE url = document.getElementById(sourceId).value; } else if (navigator.userAgent.indexOf("Firefox") > 0) { // Firefox url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0)); } else if (navigator.userAgent.indexOf("Chrome") > 0) { // Chrome url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0)); } return url; } function preImg(sourceId, targetId) { var url = getFileUrl(sourceId); var imgPre = document.getElementById(targetId); imgPre.src = url; } </script>
标签:else turn input user put agent index firefox ntb
原文地址:https://www.cnblogs.com/JANCHAN/p/9117706.html