zoukankan      html  css  js  c++  java
  • 上传多图

    <?php require_once 'base.php';?>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>增加产品</title>
    <style type="text/css">
    <
    style>.fa-times {
    	font-size: 15px;
    }
    
    .panel {
    	height: 285px;
    	margin-bottom: 0;
    	margin-top: 10px;
    }
    
    .panel-heading {
    	text-align: right;
    }
    /*加号*/
    .icon-add-50 {
    	position: relative;
    	box-sizing: border-box;
    	 50px;
    	height: 50px;
    	border: 2px dashed #9a9ba3;
    	border-radius: 50%;
    }
    
    .icon-add-50:before {
    	content: '';
    	position: absolute;
    	 30px;
    	height: 2px;
    	left: 50%;
    	top: 50%;
    	margin-left: -15px;
    	margin-top: -1px;
    	background-color: #aaabb2;
    }
    
    .icon-add-50:after {
    	content: '';
    	position: absolute;
    	 2px;
    	height: 30px;
    	left: 50%;
    	top: 50%;
    	margin-left: -1px;
    	margin-top: -15px;
    	background-color: #aaabb2;
    }
    
    .updatepanel {
    	border: 1px solid #ccc;
    	text-align: center;
    }
    
    .updatepanel .addbox {
    	vertical-align: middle;
    	height: 285px;
    	line-height: 285px;
    }
    
    #image {
    	overflow: hidden;
    }
    
    .panel-body {
    	/*padding-top: 0px;
    				padding-bottom: 0px;*/
    	
    }
    
    label {
    	 100%;
    }
    </style>
    </style>
    </head>
    <body>
    	<div id="page-wrapper">
    		<div id="page-inner">
    			<div class="row">
    				<div class="col-md-12">
    					<h2>增加产品</h2>
    				</div>
    			</div>
    			<hr />
    			<label for="file">点击此处触发上传</label> <input type="file" id="file"
    				style="display: none" />
    
    			<div class="ibox-content">
    				<div class="row">
    					<div class="col-sm-4">
    						<div class="panel panel-info">
    							<div class="panel-heading">
    								<i class="fa fa-times"></i>
    							</div>
    							<div class="panel-body" style="text-align: center;">
    								<div class="row">
    									<div class="col-sm-12 col-md-12" id="image">
    										<img class="updateimg img-responsive" src="img/p_big3.jpg"
    											style=" inherit; height: 210px;" />
    									</div>
    								</div>
    							</div>
    						</div>
    					</div>
    					<div class="col-sm-4" id="updatebox">
    						<label for="file">
    							<div class="panel updatepanel">
    								<div class="addbox">
    									<span class="icon-add-50"></span>
    								</div>
    								<input type="file" id="file" style="display: none" />
    							</div>
    						</label>
    					</div>
    				</div>
    
    			</div>
    
    
    		</div>
    	</div>
    	<script src="assets/js/jquery-1.10.2.js"></script>
    	<script src="assets/js/bootstrap.min.js"></script>
    	<script src="assets/js/jquery.metisMenu.js"></script>
    	<script src="assets/js/custom.js"></script>
    	<script>
    	 //将上传图片显示在页面上
    	$(".updatepanel").height($(".panel-info").height());
    	document.getElementById('file').onchange = function() {
    		add();
    		var imgFile = this.files[0];
    		var fr = new FileReader();
    		fr.onload = function() {
    			var imgs = document.getElementsByClassName('updateimg');
    			imgs[imgs.length-1].src = fr.result;
    			/*document.getElementById('image').getElementsByTagName('img')[0].src = fr.result;*/
    		};
    		fr.readAsDataURL(imgFile);
    	};
    	function add(){
    		var html = "<div class='col-sm-4'><div class='panel panel-info'><div class='panel-heading'><i class='fa fa-times' xss=removed></i></div><div class='panel-body' style='text-align: center;'><div class='row'><div class='col-sm-12 col-md-12'><img class='updateimg img-responsive' src='img/p_big3.jpg' style=' inherit;height: 210px;'/></div></div></div></div></div>";
    		$("#updatebox").before(html);
    	}
    	$(".fa-times").click(function(){
    		$(this).parent().parent().parent().remove();
    	});
    	</script>
    </body>
    </html>
    
    
  • 相关阅读:
    认识EXTJS
    Ext面向对象开发实践(turn)
    20多个在线操作系统(webOS)一览
    一个成功的博客必须知道的80个博客工具
    163.com免费邮箱背后的传奇故事
    Android ListView的滚动条始终显示并且滚动条样式自定义
    eclipse不格式化注释
    Android横屏竖屏切换
    喝茶的好处
    Android设置Gridview中的内容不滚动,然后控件中的内容随便添加的效果。
  • 原文地址:https://www.cnblogs.com/dashucoding/p/11140300.html
Copyright © 2011-2022 走看看