RayC
RayC

Reputation: 1

Javascript function fails to execute in safari, firefox and chrome

<script>
function moveon() {
//display a modal dialog to ask the user question
var answer = confirm("Ready to move on? ");

// If they clicked the "ok" button, make the browser load a new page. 
if (answer)
window.location = "http://google.com";
}

//run the function defined above 1 minute (60,000 milliseconds) from now
setTimeout(moveon, 60000); 
</script>

I'm wondering why this code fragment failed to execute in my html file even though it is straight from javascript definitive guide.

i'm a mac user so haven't had a chance to test on pc.

Upvotes: 0

Views: 294

Answers (1)

Stuart Kershaw
Stuart Kershaw

Reputation: 17671

Try:

window.location.href = "http://google.com";

Upvotes: 1

Related Questions