
wordpress开启允许评论多层嵌套之后,在回复评论时出现“addcomment 未定义js代码错误”提示。查看源代码,发现在“回复”链接中的确是加了:onclick=’return addComment.moveForm。解决Wordpress addcomment 未定义js代码错误问题就要添加一个js,具体代码如下:
addComment = { moveForm : function(commId, parentId, respondId, postId) { var t = this, div, comm = t.I(commId), respond = t.I(respondId), cancel = t.I('cancel-comment-reply-link'), parent = t.I('comment_parent'), post = t.I('comment_post_ID'); if ( ! comm || ! respond || ! cancel || ! parent ) return; t.respondId = respondId; postId = postId || false; if ( ! t.I('wp-temp-form-div') ) { div = document.createElement('div'); div.id = 'wp-temp-form-div'; div.style.display = 'none'; respond.parentNode.insertBefore(div, respond); } comm.parentNode.insertBefore(respond, comm.nextSibling); if ( post && postId ) post.value = postId; parent.value = parentId; cancel.style.display = ''; cancel.onclick = function() { var t = addComment, temp = t.I('wp-temp-form-div'), respond = t.I(t.respondId); if ( ! temp || ! respond ) return; t.I('comment_parent').value = '0'; temp.parentNode.insertBefore(respond, temp); temp.parentNode.removeChild(temp); this.style.display = 'none'; this.onclick = null; return false; } try { t.I('comment').focus(); } catch(e) {} return false; }, I : function(e) { return document.getElementById(e); }}
或者下载本博客实正在使用的代码:
地址:http://kankan.at/5
人吐槽 | 人点赞 |
发表评论