Kindeditor單獨(dú)調(diào)用多圖上傳實(shí)例
html代碼:
<input type="button" id="J_selectImage" value="圖片上傳" /> <div id="J_imageView"> <?php foreach($imgs as $row):?> <div class="img_view"><img class='iYuUpload-View' src='/Uploads/<?php echo $row['file_url'];?>'/><span class="view_del"id="<?=$row["id"]?>"><img delTarget="p_<?=$row['id']?>" src="/Public/Home/img/close_delete_2.png"></span></div> <input type='hidden' thumbID="p_<?=$row['id']?>" value='<?=$row['thumbnail_url']?>' name='thumbPath[]' > <input type='hidden' thumbID="p_<?=$row['id']?>" value='<?=$row['file_url']?>' name='imagePath[]'> <?php endforeach;?> </div>
JS代碼:
<script>
function clearUploadPic(i,obj){
$("input[preImagePathId="+i+"]").val("");
$("input[preThumbPathId="+i+"]").val("");
obj.remove();
}
KindEditor.ready(function(K) {
window.editor = K.create('#editor_id', {
height:'500px',
uploadJson: '<?=u('Upload/editorUpload?uid='.cookie('uid'))?>',
items : [
'source','fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
'insertunorderedlist', '|', 'image']
});
K('#J_selectImage').click(function() {
editor.loadPlugin('multiimage', function() {
editor.plugin.multiImageDialog({
clickFn : function(urlList) {
var div = K('#J_imageView');
//div.html('');
K.each(urlList, function(i, data) {
div.append('<div class="img_view"><img src="' + data.url + '"><span class="view_del" onclick="clearUploadPic('+i+',$(this).parent())"><img src="/Public/Home/img/close_delete_2.png"></span></div>');
div.append('<input preImagePathId="'+i+'" name="imagePath[]" class="image-path" type="hidden" value="' + data.url +'">');
div.append('<input preThumbPathId="'+i+'" name="thumbPath[]" class="thumb-path" type="hidden" value="' + data.mini_url + '">');
//$("#thumbPath").val($("#thumbPath").val()+""+ data.mini_url);
});
editor.hideDialog();
}
});
});
});
})
</script>
以上這篇Kindeditor單獨(dú)調(diào)用多圖上傳實(shí)例就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
從setTimeout看js函數(shù)執(zhí)行過(guò)程
這篇文章主要介紹了從setTimeout看js函數(shù)執(zhí)行過(guò)程,需要的朋友可以參考下2017-12-12
js 輸出內(nèi)容到新窗口具體實(shí)現(xiàn)代碼
js 輸出內(nèi)容一般都是在本窗口,如果要實(shí)現(xiàn)在新窗口的話該如何實(shí)現(xiàn)呢?下面與大家分享具體的代碼2013-05-05
JavaScript實(shí)現(xiàn)網(wǎng)站訪問(wèn)次數(shù)統(tǒng)計(jì)代碼
每個(gè)網(wǎng)站管理者,都必須知道每天有多少人訪問(wèn)了本站,需要一個(gè)網(wǎng)站訪問(wèn)次數(shù)功能來(lái)滿(mǎn)足需求,本篇文章主要介紹了JavsScript實(shí)現(xiàn)網(wǎng)站訪問(wèn)次數(shù)統(tǒng)計(jì)代碼,需要的朋友可以參考下2015-08-08
Js實(shí)現(xiàn)累加上漂浮動(dòng)畫(huà)示例
這篇文章主要為大家介紹了Js實(shí)現(xiàn)累加上漂浮動(dòng)畫(huà)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-11-11
如何利用JavaScript獲取字符串中重復(fù)次數(shù)最多的字符
這篇文章主要給大家介紹了關(guān)于如何利用JavaScript獲取字符串中重復(fù)次數(shù)最多的字符的相關(guān)資料,文中介紹了兩種解決方案,分別是使用對(duì)象以及數(shù)組&指針來(lái)實(shí)現(xiàn),需要的朋友可以參考下2021-07-07
無(wú)constructor的class類(lèi)還能new嗎問(wèn)題解析
這篇文章主要為大家介紹了無(wú)constructor的class類(lèi)是否還能new的問(wèn)題解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-03-03
Python版實(shí)現(xiàn)微信公眾號(hào)掃碼登陸
這篇文章主要介紹了Python版實(shí)現(xiàn)微信公眾號(hào)掃碼登陸,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-05-05
JavaScript具有類(lèi)似Lambda表達(dá)式編程能力的代碼(改進(jìn)版)
在之前的一篇博文中我介紹了一種方法可以讓JavaScript具有一種近似于Lambda表達(dá)式的編程能力——但是它有一些缺點(diǎn),其中妨礙它的使用的最主要的一條就是多了一層括號(hào),讓代碼變得難以閱讀。2010-09-09
js仿微博實(shí)現(xiàn)統(tǒng)計(jì)字符和本地存儲(chǔ)功能
這篇文章主要介紹了js仿微博實(shí)現(xiàn)統(tǒng)計(jì)字符和本地存儲(chǔ)功能的相關(guān)資料,需要的朋友可以參考下2015-12-12

