thesmart1
01-06-2007, 12:27 AM
I made a ticker for my site in JS. It's supposed to create a variable, then load content based on the value of the variable and add 1 to its value every time it loads new content (which is dictated by a timeout), until it eventually resets the variable to the starting value. Then it should load the content into a div on the page. But it's not changing the content in the div.
I have the script properly sourced, the timeout function called in the body tag, and the appropriate id in the div. And the JS is below:
function loadcontent(){
content=0
if (content==0){
document.getElementById('tickerdiv').innerHTML="<b><a href='http://games.pehjota.com/'>Games</a></b><br>Play my games!";
content=content+1
}
if (content==1){
document.getElementById('tickerdiv').innerHTML="<b><a href='http://radio.pehjota.com/'>P. J. Radio</a></b><br>Listen to my online radio!";
content=content+1
}
if (content==2){
document.getElementById('tickerdiv').innerHTML="<b><a href='http://rhe.pehjota.com/'>Red Hat Entertainment</a></b><br>Watch my movies and shows!";
content=content+1
}
if (content==3){
document.getElementById('tickerdiv').innerHTML="<b><a href='http://www.activeboard.com/forum.spark?forumID=84551'>Forum</a></b><br>Join my forum!";
content=content+1
}
if (content==4){
document.getElementById('tickerdiv').innerHTML="<b><a href='http://random.pehjota.com/'>Random Stuff</a></b><br>Find funny jokes, quotes, pictures, and more!";
content=content+1
}
if (content==5){
document.getElementById('tickerdiv').innerHTML="<b><a href='http://downloads.pehjota.com/'>Downloads</a></b><br>Like something on my site? Download it for free!";
content=content+1
}
if (content==6){
document.getElementById('tickerdiv').innerHTML="<b><a href='http://tests.pehjota.com/'>Tests</a></b><br>Take my fun tests, including an 'Are you Special?' test!";
content=content-6
}
}
function loadticker(){
var t=setTimeout('loadcontent()',300)
}
I have the script properly sourced, the timeout function called in the body tag, and the appropriate id in the div. And the JS is below:
function loadcontent(){
content=0
if (content==0){
document.getElementById('tickerdiv').innerHTML="<b><a href='http://games.pehjota.com/'>Games</a></b><br>Play my games!";
content=content+1
}
if (content==1){
document.getElementById('tickerdiv').innerHTML="<b><a href='http://radio.pehjota.com/'>P. J. Radio</a></b><br>Listen to my online radio!";
content=content+1
}
if (content==2){
document.getElementById('tickerdiv').innerHTML="<b><a href='http://rhe.pehjota.com/'>Red Hat Entertainment</a></b><br>Watch my movies and shows!";
content=content+1
}
if (content==3){
document.getElementById('tickerdiv').innerHTML="<b><a href='http://www.activeboard.com/forum.spark?forumID=84551'>Forum</a></b><br>Join my forum!";
content=content+1
}
if (content==4){
document.getElementById('tickerdiv').innerHTML="<b><a href='http://random.pehjota.com/'>Random Stuff</a></b><br>Find funny jokes, quotes, pictures, and more!";
content=content+1
}
if (content==5){
document.getElementById('tickerdiv').innerHTML="<b><a href='http://downloads.pehjota.com/'>Downloads</a></b><br>Like something on my site? Download it for free!";
content=content+1
}
if (content==6){
document.getElementById('tickerdiv').innerHTML="<b><a href='http://tests.pehjota.com/'>Tests</a></b><br>Take my fun tests, including an 'Are you Special?' test!";
content=content-6
}
}
function loadticker(){
var t=setTimeout('loadcontent()',300)
}