PDA

View Full Version : variable web page


king
10-26-2002, 02:27 PM
hi every one
i want to design a web page that has a content that changes with time. when u open the page some text is appear and after 20s it disappears and another text is appeared and so on, untill the end of the texts, then it goes to the first text.
;)

Vladdy
10-26-2002, 03:01 PM
If you think that making text big and bold makes it easier to comprehend, here is an answer to your question: :D :D


<script>
texts = new Array("text1","text2", .... , "textN");
nextText = 0;

function changeText()
{ document.getElementById("ChangingText").firstChild.nodeValue=texts[nextText];
nextText++;
if(nextText=texts.length) nextText=0;
return;
}
</script>

<body onload="JavaScript: setInterval("changeText()", 20000)">

<p id="ChangingText">Starting Text</p>