I am not all that familiar with JavaScript. I have a piece of code below that was developed by a predecessor of mine for a Detail page button. The code works fine, but I would now like to use it as part of an embedded Visualforce page's Commandbutton. Can anyone help on how I would convert this to use in a script call for a VF page?
Javascript (Detail Button):
{!RequireScript("/soap/ajax/35.0/connection.js")}
var a = new sforce.SObject("Account");
a.id = "{!Account.Id}";
a.Mark_Account__c = !{!Account.Mark_Account__c};
sforce.connection.update([a]);
window.location.reload();
Javascript (VF Page):
<apex:includeScript value="/soap/ajax/35.0/connection.js" />
<script type="text/javascript">
function Mark();
{
var a = new sforce.SObject("Account");
a.id = "{!Account.Id}";
a.Mark_Account__c = !{!Account.Mark_Account__c};
sforce.connection.update([a]);
window.location.reload();
}
</script>
<apex:form >
<apex:commandButton value="Mark" onClick="Mark();return false;"/>
</apex:form>