I'm trying to set up my onblur
so it shows a loading bar for 3 seconds... however the code seems to just miss it out and go straight to the second function...
function seriesIdOnBlur()
{
document.getElementById("series_id_check").innerHTML = "<img src='http://www.webscriptlab.com/file/loading/output/13759195689.gif' /> ";
setTimeout(seriesIdOnBlur2(), 3000);
}
function seriesIdOnBlur2()
{
var id = document.getElementById("series_id").value;
var message = "";
if (series[id] === undefined)
{
message = "The Series ID you input was invalid";
}
else
{
var seriesId = series[id];
var game = seriesId['game'];
var name = seriesId['name'];
message = "ID: " + id + " is for the " + name + " series playing " + game + ".";
}
document.getElementById("series_id_check").innerHTML = "<span>" + message + "</span>";
}
seriesIdOnBlur
is called onBlur
for the input with id series_id
.
What am I doing wrong with the setTimeout
?