2013-02-20 22 views
0

這裏是我的代碼如何使用鏈接而不是警報?

function destroy() 
{ 
    if (confirm("Are you sure?")) { 
     alert("User will be deleted") 
    } 

    else { 

    } 

} 

但我不希望顯示警告消息,我希望用戶通過我自己的鏈接重定向。 我應該寫什麼而不是alert來做到這一點?

+2

在問這個問題之前你有搜索嗎?重複:http://stackoverflow.com/questions/4744751/javascript-redirect – 2013-02-20 09:33:56

回答

2
if (confirm("Are you sure?")) { 
    window.location = 'your_link_here'; 
} 
相關問題