On news and big website home pages, sometimes you get blocks of text, such as news, that changes to different content after a period of time, say 10 seconds. Im just wondering how to change the contet of a <Div> to do this? Im guessing its a java script technique. I have never really written java script though I can code Java. thanks
Done it for you : <script type="text/javascript"> function initChangeText() { var time = 10; setInterval('changeText();',time*1000); } function changeText() { var divs_ = document.getElementsByTagName("div") for (var i = 0;i<divs_.length;i++) if (divs_[i].className == "change") changeULText(divs_[i]); } function changeULText(obj) { var ul = obj.getElementsByTagName("ul")[0]; var li = obj.getElementsByTagName("li"); for (var i=0;i<li.length;i++) { if (li[i].className == "show") { li[i].className = ""; li[(i+1)%li.length].className = "show"; return ; } } } window.onload = initChangeText; </script> HTML: This is preety much the script, and with CSS and HTML it looks like this (see attached file)