I have this code
window.onload = function() { function foo() { alert(\"test\"); } setInterval(\"foo()\",500) }
Alternatively, you can define the function within the call to setInterval:
window.onload = function() { setInterval( function foo() { alert("test"); }, 500 ); }