`
liuwei_blog
  • 浏览: 91071 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

csdn文章内容显示与折叠

阅读更多

csdn文章的显示与折叠,在编辑器中点击源视图:

 

1.添加自己的代码

 

<!-- 添加自己的代码--> 

<DIV style="BORDER-RIGHT: 1px; BORDER-TOP: 1px; BORDER-LEFT: 1px; CURSOR: hand; BORDER-BOTTOM: 1px" onclick=toggle(this,'myContent')>+Code</DIV>
<SCRIPT type=text/javascript>
  function toggle(obj,id){
    var content = document.getElementById(id);
    if(content.style.display == 'none'){
      content.style.display = 'block';
      obj.innerHTML = '-Code';
    }else{
      content.style.display = 'none';
      obj.innerHTML = '+Code';
    }
  }
</SCRIPT>


2.给div添加id属性、style属性

 

<!-- 以下是文章内容,根据需要给div添加id属性、style属性 -->

<DIV class=highlighter id=myContent style="DISPLAY: none">  ... </div>


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics