onclick="return confirm('Wanna send a mail?');"
If you return a false onclick the method will not be called. The confirm function returns true or false (OK or Cancel).
/////////----------------------------------------///////
Display Type : Detail Page Button
Behavior : Execute Javascript
Content Source : Onclick Javascript
and in the text box copy the below JS code ,
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")} var x; if (confirm("Wanna send a mail!") == true) { x = "YES"; } else { x = "NO"; } if(x == 'NO'){ window.location.replace('/{!Account.Id}') }
else { window.location.replace('/apex/AccountDetail?id={!Account.Id}') //replace your VF page here }
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")} var x; if (confirm("Wanna send a mail!") == true) { x = "YES"; } else { x = "NO"; } if(x == 'NO'){ window.location.replace('/{!Account.Id}') } else { window.location.replace('/apex/AccountDetail?id={!Account.Id}') //replace your VF page here }