+ Start a Discussion

retain the command button colour change after performing form save and re-render

Is there a way to retain the apex:command button colour even after the form is re-rendered
<apex:page standardController="Account">
    <apex:form id="f" >
        <apex:pageBlock title="My Content" mode="edit">
            <apex:pageBlockSection title="My Content Section" columns="2">
                <apex:inputField value="{!account.name}"/>
                <apex:inputField value="{!account.accountNumber}"/>
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" onclick="this.style.background='blue';" reRender="f"  value="Save"/>
    <apex:outputText>test button colour</apex:outputText>

 and some action like create/update is performed.
When i hit the save buton colour changes and reverts back to the original colour.any possible workaround will be helpful.
On save it will redirect to the detail page. Where do you want to set the color?
 I have a detail page code .with account id.. ..this is just that i want to set the colour to be the same after any logic<like updating a field is  performed.
the url will be something like this:
https://c.ap1.visual.force.com/apex/accountdetailpage?id=0019000001CWOzi for the detail page and certain logics are being performed on that
based on command button click
<apex:commandButton action="{!save}" onclick="this.style.background='blue';" reRender="f" value="Save"/>

Then, you may need to set the button color on page load