zjq:modify mutipy picture

This commit is contained in:
lovelyzhang 2016-12-25 15:10:05 +08:00
parent 775a8b2f6f
commit e934a901ee
2 changed files with 1680 additions and 11 deletions

View File

@ -38,9 +38,10 @@
<div class="form-group"> <div class="form-group">
<div class="col-md-12"> <div class="col-md-12">
<div id="image-upload"> <div id="image-upload">
<div id="total">当前选择上传0个图片</div><input class="btn btn-default" type="button" value="添加图片" id="btnAdd" onclick="selectAttachment();">&nbsp; <div id="total">当前选择上传0个图片</div>
<input type="button" value="清空图片" id="btnClear" style="display:none" onclick="clearAttachment();"> <input class="btn btn-default" type="button" value="添加图片" id="btnAdd" onclick="selectAttachment();">&nbsp;
<div id="attachmentList"></div> <input class="btn btn-default" type="button" value="清空图片" id="btnClear" style="display:none" onclick="clearAttachment();">
<div id="attachmentList" style="display: none"></div>
</div> </div>
</div> </div>
</div> </div>
@ -87,14 +88,14 @@
var i = 0; // 用来动态生成span,upfile的id var i = 0; // 用来动态生成span,upfile的id
function addAttachmentToList() { function addAttachmentToList() {
if (findAttachment(event.srcElement.value)) return; //如果此文档已在图片列表中则不再添加 if (findAttachment(event.srcElement.value)) return; //如果此文档已在图片列表中则不再添加
if(extractFileName(event.srcElement.value)) {
// 动态创建图片信息栏并添加到图片列表中 // 动态创建图片信息栏并添加到图片列表中
var span = document.createElement('span'); var span = document.createElement('span');
span.id = '_attachment' + i; span.id = '_attachment' + i;
span.innerHTML = extractFileName(event.srcElement.value) + '&nbsp;<a href="javascript:delAttachment(' + (i++) + ')"><font color="blue">删除</font></a><br/>'; span.innerHTML = extractFileName(event.srcElement.value) + '&nbsp;<a href="javascript:delAttachment(' + (i++) + ')">删除</a><br/>';
span.title = event.srcElement.value; span.title = event.srcElement.value;
G('attachmentList').appendChild(span); G('attachmentList').appendChild(span);
}
// 显示图片列表并变换添加图片按钮文本 // 显示图片列表并变换添加图片按钮文本
if (G('attachmentList').style.display == 'none') { if (G('attachmentList').style.display == 'none') {
G('btnAdd').value = '继续添加'; G('btnAdd').value = '继续添加';

File diff suppressed because it is too large Load Diff