怎样强制让topic-content的链接在新标签打开
By
szdbb112
at 2015-05-30 • 0人收藏 • 1625人看过
loadScript(WebsitePath + "/static/editor/ueditor.parse.min.js", function(){ //强制所有链接在新窗口中打开 var AllPosts = document.getElementsByClassName("comment-content"); PostContentLists = {};//Global AllPosts[AllPosts.length]=document.getElementsByClassName("topic-content")[0]; if(document.getElementsByClassName("topic-content").length>0){ PostContentLists[document.getElementsByClassName("topic-content")[0].childNodes[1].id] = trim3(document.getElementsByClassName("topic-content")[0].childNodes[1].innerHTML); } //console.log(PostContentLists); for (var j=0; j<AllPosts.length; j++) { PostContentLists[document.getElementsByClassName("comment-content")[j].childNodes[5].id] = trim3(document.getElementsByClassName("comment-content")[j].childNodes[5].innerHTML); //console.log(PostContentLists); var AllLinks = AllPosts[j].getElementsByTagName("a"); for(var i=0; i<AllLinks.length; i++) { var a = AllLinks[i]; //console.log(a); if(a.host != location.host){ a.target="_blank"; } }; };
这个是让评论的链接在新标签打开,该怎么修改呢
2 个回复 | 最后更新于 2015-05-30
登录后方可回帖
@lincanbin
如上