解决上传图片预览在浏览器中不显示的问题
程序员文章站
2022-03-03 13:51:48
...
使用一个图片上传预览插件uploadPreview插件
引入uploadPreview.min.js文件
<script type="text/javascript" src="${pageContext.request.contextPath}/jslib/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/uploadPreview/uploadPreview.min.js"></script>
demo演示
<head>
<title>uploadPreview演示</title>
<script src="uploadPreview.js" type="text/javascript"></script>
<script>
window.onload = function () {
new uploadPreview({ UpBtn: "up_img", DivShow: "imgdiv", ImgShow: "imgShow" });
}
</script>
</head>
<body>
<div id="imgdiv">
<img id="imgShow" width="100" height="100" />
</div>
<input type="file" id="up_img" />
</body>
上一篇: 一切皆为JavaScript
下一篇: css该如何去掉背景颜色呢