//图片预览 function getFileUrl(sourceId) { var url; if (window.ActiveXObject || “ActiveXObject” in window) { // 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); if (imgFormat(sourceId)) { imgPre.src = url; } } //图片格式校验 function imgFormat(nodeId) { if ($("#" + nodeId).val() != “”) { var imgFileName = “jpg,png,jpeg”; var imgName = KaTeX parse error: Expected 'EOF', got '#' at position 3: ("#̲" + nodeId).val…(“input[name=‘license’]”).val() != “” || $(“input[name=‘shopLogo’]”).val() != “” || $(“input[name=‘shopImages’]”).val() != “” && $("#" + nodeId).val() == “”) { return true; } else { alert(“请上传图片!”); return false; } }