簡體   English   中英

Javascript函數無法在Safari,Firefox和Chrome中執行

[英]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>

我想知道為什么這個代碼片段無法在我的html文件中執行,即使它直接來自javascript權威指南。

我是Mac用戶,所以還沒有機會在PC上進行測試。

嘗試:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM