Reputation: 83
window.onload = setInterval(myFunc, 5000);
function myFunc(){
alert("This is a test.");
}
Is there any way to stop the function after 1 interval or to just have it perform 1 interval?
Upvotes: 0
Views: 54
Reputation: 2422
Use setTimeout
window.onload = setTimeout(myFunc, 5000);
function myFunc(){
alert("This is a test.");
}
Upvotes: 1