lolnkinkade
Friday, July 4th, 2008Below is the bit of javascript that handles the text transitioning at the above URL. More than anything this was a way for me to explore the use of setInterval(), a javascript builtin function which I didn’t previously know about.
setInterval('lolme()', 1000);
i = 0;
function lolme() {
var ar_lol = new Array(
"nath@nkinka.de?",
"lol",
"rofl",
"omg wtf bbq",
":-)",
";-)"
);
var ar_cnt = ar_lol.length;
(i == 0) ? pi = ar_cnt - 1 : pi = i - 1;
var loldiv = document.getElementById('lol');
if ( loldiv.childNodes[0] ) {
loldiv.removeChild(loldiv.childNodes[0]);
}
loldiv.appendChild(document.createTextNode(ar_lol[i]));
(i == ar_cnt - 1) ? i = 0 : i++;
}