+ Start a Discussion
diydiy 

command link onclick colors

I have 5 records in pageblock table.. 1st field is a command link using param tag.. when i click 1 means , 1 will be change an red color... others are same standard color.. if i click 2 means , 2 has a red color and 1 has change into old color like standard color.. if  i click 3 means , 3 changed as a red.. remain all are standard color

Ashish_SFDCAshish_SFDC

Hi Diya, 

 

Try the below options, 

 

You'd usually do this through CSS styling.  The style in question is 'a:visited',  e.g.

 

<style>
a:link {background: #FFCC00; text-decoration: none}
a:visited {background: #FFCC00; text-decoration: none}
a:active {background: #FFCC00; text-decoration: none}
a:hover {background: #FFCC00; font-weight:bold; color: red;}
</style>

 

 

Or 

 

<apex:form >
 <script type="text/javascript">  
            function turnRed(id) {
                 alert("hi");
                 var myPara = document.getElementById(id);
                 alert(myPara);
                 myPara.style.color = "green";
            }
        </script>
        <apex:pageBlock >
  <apex:commandLink  action="{!gogoogle}" target="_blank" value="Go Google"  id="check" style="color:red"  onclick="turnRed('{!$Component.check}')"/>

</apex:form>

 

Regards,

Ashish