‘setInterval’ vs ‘setTimeout’

setTimeout(expression, timeout); runs the code/function once after the timeout. setInterval(expression, timeout); runs the code/function repeatedly, with the length of the timeout between each repeat. Example:

display variable image using cookies

Have you considered using PHP instead? I feel that it would be a lot more straightfoward. Use setcookie and then simple if and elseif statements to check what the cookie is, and display a corresponding image. This seems a lot simpler than what you’re trying to do with JavaScript, but maybe that’s just because I use PHP … Read more