[SalesForce] Custom button javascript error on Unexpected token ILLEGAL

I have a custom button where I want to check for conformation. I wrote my javascript for conformation but I am getting error that

A problem with the OnClick JavaScript for this button or link was encountered:
Unexpected token ILLEGAL

What is the reason behind this error. Please help me to solve this error.

my code :

{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")}
var txt;
var r = confirm("Are you sure!");
if (r == true) {
    url 
} 

Best Answer

Try to use following code:

var confirmation = confirm("Are you sure!");
if (confirmation == true) {
    window.location.href = url;
}
Related Topic