Table of contents Home page
Execute this code
var origColor var id changeColor.cnt = 0 function changeColor(body, origColor) { switch (changeColor.cnt++) { case 0: background = '#ffcc00' break case 1: background = '#d30300' break default: clearInterval(id) background = origColor } body.style.backgroundColor = background } // Change the background colour three times, with intervals of 0.5 s. // The last time the colour will get its original value back. var body = document.getElementById("body") id = setInterval(changeColor, 500, body, body.style.backgroundColor) changeColor.cnt = 0 // Reset the counter in case the user wants to execute the code again during this session.