一:将按钮线下背景图
代码:<input type='file' class="img" name='{$field.attr_24}' value=''>
css样式为:
<style>
.img{
width: 355px;
height: 249px;
background: url(../img/exam.png) no-repeat center;//这个是背景图
cursor: pointer;
display: block;
font-size: 0;
line-height: 0;
text-indent: -9999px;
}
</style>
JS为:
<script>
$(".img").change(function(){
var reader = new FileReader();
var file = this.files[0];
reader.readAsDataURL(file);
reader.onloadend = function(){
$(".img").css("background", "url"+"("+ reader.result +")"+" no-repeat");
$(".img-ppoo").css("background-size", "contain");
}
})
</script>
CopyRight 2006-2020 YCNH NETWORK , Inc. All Rights Reserved 专业互联网开发服务提供商-云创年华网络 服务热线:18030990768 蜀ICP备16001235号 网站地图
四川云创年华网络提供绵阳网站建设制作、成品模板、快速仿站、微信小程序开发等服务。 正规合法经营实体公司,可来人实地洽谈业务,营业执照查验: