[SalesForce] Custom Button : Conditional Redirect to URL using Javascript

URL Image
I am connecting to the URL by using custom button when Update__c = true condition reamin all conditions these button connect to different URL. but when i used
below code it showing URL Breaks, but the URl is working.I placed this code in Buttons Section.
but IN URL it showing like that

https://na15.salesforce.com/servlet/if(%27true%27%20==%20%27true%27)%7B%20%20%20%20window.location.href%20=%20%27/_ui/core/email/author/EmailAuthor?id=a00i000000KtP5X%27%20;}

 if('{!Quote__c.Updated__c}' == 'true')
 {
   window.location.href = '/_ui/core/email/author/ EmailAuthor?id={!Quote__c.Id}' ;
}

Best Answer

If you want to execute JavaScript when the button is clicked (for your conditional logic), you need to use the "Execute JavaScript" and "OnClick JavaScript" options.