Jump to content

how to make a billboard


jwk811

Recommended Posts

thorpe he is looking for a text rotator.

jwk811 what you are looking for is a combination of JavaScript, possible mixed with PHP and if done  dynamically without refreshing the rest of the page, what it is referred to is AJAX (Asynchronous JavaScript and XML).

now what you need to decide is the next step, are the paragraphs you want to rotate, going to be all loaded when the page opens or do you want to load a different paragraph every few seconds?
A working example:
[code]<html>
<head>

<script>

var ratateSeconds = 10;

paragraphs = new Array();
paragraphs[0] = "Paragraph One";
paragraphs[1] = "Paragraph Two";
paragraphs[2] = "Paragraph Three";
paragraphs[3] = "Paragraph Four";
paragraphs[4] = "Paragraph Five";
paragraphs[5] = "Paragraph Six";
paragraphs[6] = "Paragraph Seven";
paragraphs[7] = "Paragraph Eight";
paragraphs[8] = "Paragraph Nine";
paragraphs[9] = "Paragraph Ten";
var paraIndex = 0;

function rotatePara() {
  document.getElementById('paraDiv').innerHTML = paragraphs[paraIndex];
  paraIndex++
  if (paraIndex>=paragraphs.length) { paraIndex=0; }
  setTimeout('rotatePara()', ratateSeconds*1000)
}

</script>

</head>

<body onLoad="rotatePara();">

<div id="paraDiv"></div>

</body>
</html>[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.