while(!itisloaded) { setTimeout("++countimes",1000); if(countimes > 5) { ErrorMessage("Can't Load",'SetInfoPage',counttimes); break; } } itisloaded = false; alert(temppathcount + ' path');