利用jQuery实现拖拽图片上传表单代码



8 31 11



特效描述:利用jQuery实现 拖拽图片 上传表单 代码,利用jQuery实现拖拽图片上传表单代码

代码结构

1. 引入CSS

<link href="layui/css/layui.css" rel="stylesheet" />

2. 引入JS

<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="layui/layui.js" type="text/javascript"></script>
<script src="js/upload.js" type="text/javascript"></script>

3. HTML代码

<div class="layui-main" style="margin-top:100px;">
	<form class="layui-form" method="post" action="javascript:;">
		<div class="layui-form-item">
			<label class="layui-form-label">名称</label>
			<div class="layui-input-inline">
				<input type="text" name="username" lay-verify="required" placeholder="输入名称" autocomplete="off" class="layui-input">
			</div>
			<div class="layui-form-mid layui-word-aux">不能为空</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">图片上传</label>
			<div class="layui-inline">
				<div class="layui-upload-drag" id="upload">
					<i class="layui-icon"></i>
						<p>点击上传,或将文件拖拽到此处</p>
				</div>
			</div>
			<div class="layui-inline" id="upload_preview"></div>
		</div>
		<div class="layui-form-item layui-hide" id="upload_progress">
			<label class="layui-form-label"></label>
			<div class="layui-input-inline" style="width:21%;">
				<div class="layui-progress" lay-showpercent="true" lay-filter="upload_progress">
					<div class="layui-progress-bar layui-bg-blue" lay-percent="0%"></div>
				</div>
			</div>
		</div>
		 <div class="layui-form-item layui-hide" id="upload_progress">
			<label class="layui-form-label"></label>
			<div class="layui-input-inline" style="width:21%;">
				<div class="layui-progress" lay-showpercent="true" lay-filter="upload_progress">
					<div class="layui-progress-bar layui-bg-blue" lay-percent="0%"></div>
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"></label>
			<div class="layui-input-inline">
				<button class="layui-btn" lay-submit>提交表单</button>
			</div>
		</div>
	</form>
</div>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: 切换按钮 表单 表单美化 表单插件 表单美化插件 文件上传 文本框 text文本框

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到