欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

百度ueditor組件上傳圖片后如何設(shè)置img里的alt屬性

 更新時(shí)間:2014年09月01日 08:58:01   投稿:whsnow  
百度ueditor組件,使用上傳圖片后,設(shè)置了一個(gè)alt屬性,其值是上傳圖片時(shí)的本地路徑,如果想更改的話可以參考下面的解決方法

百度ueditor組件,使用上傳圖片后,自動(dòng)將上傳圖片顯示在編輯器中,也就是插入了一個(gè)<img>標(biāo)簽。并設(shè)置了一個(gè)alt屬性,其值是上傳圖片時(shí)的本地路徑。暫時(shí)沒(méi)發(fā)現(xiàn)哪里可以配置這個(gè)值。在查看發(fā)布的內(nèi)容時(shí),看到alt的值是一個(gè)磁盤(pán)路徑,有點(diǎn)別扭。

可以在編輯完內(nèi)容,保存到數(shù)據(jù)庫(kù)時(shí)過(guò)濾下,修改alt的內(nèi)容,也可以直接修改源碼

function callback(){
try{
var link, json, loader,
body = (iframe.contentDocument || iframe.contentWindow.document).body,
result = body.innerText || body.textContent || '';
json = (new Function("return " + result))();
link = me.options.imageUrlPrefix + json.url;
if(json.state == 'SUCCESS' && json.url) {
loader = me.document.getElementById(loadingId);
loader.setAttribute('src', link);
loader.setAttribute('_src', link);
loader.setAttribute('title', json.title || '');
loader.setAttribute('alt', json.original || '');
loader.removeAttribute('id');
domUtils.removeClasses(loader, 'loadingclass');
} else {
showErrorLoader && showErrorLoader(json.state);
}
}catch(er){
showErrorLoader && showErrorLoader(me.getLang('simpleupload.loadError'));
}
form.reset();
domUtils.un(iframe, 'load', callback);
}

相關(guān)文章

最新評(píng)論