Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
113
rated 0 times [  116] [ 3]  / answers: 1 / hits: 27873  / 12 Years ago, thu, march 29, 2012, 12:00:00

I am using a confirm() function for logging out. How can i check whether the user clicked Ok or Cancel. My confirm function is



confirm('Are You Sure')



But now, while clicking both Ok and Cancel the page redirects. How can I resolve it?


More From » javascript

 Answers
1
if (confirm('Are You Sure?')){
window.location = http://www.google.com/;
}else{
alert(You are not redirected.)
}


DOCUMENTATION


[#86544] Wednesday, March 28, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
paolam

Total Points: 437
Total Questions: 107
Total Answers: 106

Location: Aland Islands
Member since Wed, Nov 17, 2021
3 Years ago
paolam questions
Thu, Oct 29, 20, 00:00, 4 Years ago
Wed, Nov 20, 19, 00:00, 5 Years ago
;