Executing multiple commands with Javascript setTimeout
The only gotcha is that all your commands must be on one
line separated by semi-colons. So the code below works:
setTimeout("alert('hi mom'); alert('hi dad');", 1000);
But the code below would not:
setTimeout("
alert('hi mom');
alert('hi dad');"
, 1000);
See also