Effective code of Hide/Show links

原来在LBS上实现了,也忘记是哪里学来的,贴过来。(不过没有在WP里测试过)
网站显示、隐藏代码修改,操作过程如下:

1.先在style.css里添加:

/*Hidden*/
.commenthidden {display:none}
.commentshown {display:inline}

2.再header.php里上面添加:

<!– Hide/Show Links–>
<script type=”text/Javascript”>
function togglecomments (postid) {
var whichpost = document.getElementById(postid);
if (whichpost.className==”commentshown”) { whichpost.className=”commenthidden”; } else { whichpost.className=”commentshown”; }
} </script>
<!– Hide/Show Links–>

3.最后就是应用代码了:

<a href=”javascript:togglecomments(’myfriendlistss’);” title=”[显示/隐藏]所有文字链接.”><font color=”#660099″><b>*Friend Blog Link*</b></font></a>
<div id=”myfriendlistss” class=”commenthidden”>
<a href=”http://www.wackstudio.com/” target=”_blank”>WackStudio</a><br />
</div>

看看效果哈!

Share and Enjoy:

  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Technorati
  • YahooMyWeb
  • Live
  • Google
  • Print this article!

Related Posts

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*