搜索

Discuz x3.1门户文章图片添加alt属性

热度 1已有 2218 次阅读2014-7-31 14:39 | 图片, 文章


修改源文件:static/image/editor/editor_function.js insertImage函数
function insertImage(image, url, width, height, subject) {
        url = typeof url == 'undefined' || url === null ? image : url;
        width = typeof width == 'undefined' || width === null ? 0 : parseInt(width);
        height = typeof height == 'undefined' || height === null ? 0 : parseInt(height);
        subject = $('title').value;
        var html = '<p><a href="' + url + '" target="_blank"><img alt="'+subject+'" src="'+image+'"'+(width?' width="'+width+'"':'')+(height?' height="'+height+'"':'')+'></a></p>';
        edit_insert(html);
}
这里是x3.1版本其他版本稍微有区别但是思路都是一样的,然后修改这里会与个人空间发布日志插入图片有所冲突所以建议复制一份  editor_function.js然后改名为 blogeditor_function.js里面insertImage函数修改如下::然后修改个人空间日志发布模板spacecp_blog.htm查找editor_function.js修改为blogeditor_function.js
function insertImage(image, url, width, height, subject) {
        url = typeof url == 'undefined' || url === null ? image : url;
        width = typeof width == 'undefined' || width === null ? 0 : parseInt(width);
        height = typeof height == 'undefined' || height === null ? 0 : parseInt(height);
        subject = $('subject').value;
        var html = '<p><a href="' + url + '" target="_blank"><img alt="'+subject+'" src="'+image+'"'+(width?' width="'+width+'"':'')+(height?' height="'+height+'"':'')+'></a></p>';
        edit_insert(html);

刚表态过的朋友 (0 人)

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 立即注册