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

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

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

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

可以在編輯完內容,保存到數據庫時過濾下,修改alt的內容,也可以直接修改源碼

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);
}

相關文章

最新評論