<script type=“text/javascript”>
if (document.all || document.getElementById){ //if IE4 or NS6+
document.write('<style type=“text/css”>
');
document.write('.dyncontent{display: none; width: 250px; height:
60px;}
');
document.write(‘</style>’);
}
var curcontentindex=0;
var messages=new Array();
function getElementByClass(classname){
var inc=0;
var alltags=document.all? document.all :
document.getElementsByTagName(“*”);
for (i=0; i<alltags.length; i++){
if (alltags[i].className==classname)
messages[inc++]=alltags[i];
}
}
function rotatecontent(){
//get current message index (to show it):
curcontentindex=(curcontentindex<messages.length-1)?
curcontentindex+1 : 0;
//get previous message index (to hide it):
prevcontentindex=(curcontentindex==0)? messages.length-1 :
curcontentindex-1;
messages[prevcontentindex].style.display=“none”; //hide previous
message
messages[curcontentindex].style.display=“block”; //show current
message
}
window.onload=function(){
if (document.all || document.getElementById){
getElementByClass(“dyncontent”);
setInterval(“rotatecontent()”, 2000);
}
}
</script>
Dynamic Content:
<div class=“dyncontent” style=“display: block”><a href=“http://fithope.com/2010/02/22/health-discussion.aspx”>1</div>
<div class=“dyncontent”><a href=“http://fithope.com/2010/02/22/health-discussion.aspx”>2</div>
<div class=“dyncontent”><a href=“http://fithope.com/2010/02/22/health-discussion.aspx”>3</div>
<div class=“dyncontent” style=“display: block”><a href=“http://fithope.com/2010/02/22/health-discussion.aspx”>3</div>
<div class=“dyncontent”><a href=“http://fithope.com/2010/02/22/health-discussion.aspx”>2</div>
<div class=“dyncontent”><a href=“http://fithope.com/2010/02/22/health-discussion.aspx”>1</div>
If you have time that is. I don’t understand what’s wrong with it. I’m trying to figure out a way to make a content slider that slides posts and holds 3 of them at a time.
I’m trying to get the thing at the top of techcrunch.com that holds 3 posts.