Archive for October 23rd, 2006

hacking the blogger hack, part two

Posted on the October 23rd, 2006 under techie by rayland

so now, i will show you how to hack the “How can I make show/hide links for my posts?” hack by blogger..

this is a bit trickier since on every post you make, you have to make sure that you give a unique id..

First of all, add these codes within your area and right after the closing of your style sheet..

<style>
.posthidden {display:none}
.postshown {display:inline}
</style>

<script type=”text/Javascript”>

function expandcollapse (postid) {

whichpost = document.getElementById(postid);

if (whichpost.className==”postshown”) {
whichpost.className=”posthidden”;
}
else {
whichpost.className=”postshown”;
}
}
</script>

Now for each post that you plan on adding the show/hide link to, you have to add this span tags as well as a link tag for the show/hide posts..

<span class=”posthidden” id=”WHATEVER YOU WANT TO CALL THIS POST AND MUST BE UNIQUE”></span>
<a href=”javascript:expandcollapse(‘WHATEVER YOU WANT TO CALL THIS POST AND MUST BE UNIQUE’)”>
[+/-] show/hide this post</a>

so lets say that:

Here is the beginning of my post.<span class=”posthidden” id=”example post”>And
here is the rest of it. </span>
<a href=”javascript:expandcollapse(‘example post’)”>
[+/-] show/hide this post</a>

for an example, follow this link here