CSS style change when im clicking link button

Asked By Kaleem Khan
09-Feb-10 12:55 AM
Earn up to 0 extra points for answering this tough question.

i have two sets of css,
CSS1
.maroonlinks_my:link

 


{
font-family: Tahoma; font-size: 9pt; font-weight: normal; color: #B5121B; text-decoration: underline;}

 

.maroonlinks_my:hover

 


{
font-family: Tahoma;font-size: 19pt;font-weight: normal;color: #000000;text-decoration: none;}

 

.maroonlinks_my:active

 


{
font-family: Tahoma;font-size: 29pt;font-weight: normal;color: #000000;text-decoration: none;}

 

.maroonlinks_my:visited

 


{
font-family: Tahoma;font-size: 59pt;font-weight: normal;color: #000000;text-decoration: none;}

CSS2

 

.maroonlinks

 


{
font-family: Tahoma;font-size: 9pt;font-weight: normal;color: #B5121B;text-decoration: underline;}

 

 

 

.maroonlinks:hover

 


{
font-family: Tahoma;font-size: 9pt;font-weight: normal;color: #000000;text-decoration: none;}

default link button css is maroonlinks ie CSS2
 and i placed a link button in a form, when im clicking link button it should change into maroonlinks_my ie CSS1

please reply soon

 

  re: CSS style change when im clicking link button

Huggy Bear replied to Kaleem Khan
09-Feb-10 01:00 AM
In the Button click event, set the style dynamically as shown

button1.CssClass = "CSS1";

  re: CSS style change when im clicking link button

Santhosh N replied to Kaleem Khan
09-Feb-10 01:14 AM
You could actually change the class of any element as
Object.CssClass=YourClass;
or
Object.Attributes.Add("Class",YourClass);

assuming you have both css files loaded and referenced...

  re: CSS style change when im clicking link button

Adil Saud replied to Kaleem Khan
09-Feb-10 06:03 AM
Hi,

Suppose your link button name is : lnkMyButton. and your asp.net button tag might be like this :
<asp:LinkButtin id="lnkMyButton" runat="Server" onClientClick="changeStyle(this);"></asp:LinkButton>


Javascript to change the style is :

<script language ="javascript" type="text/script">

function changeStyle(obj)
{
      if(obj!=null)
      {
             obj.className='maroonlinks_my';
      }


}

</script>

Hope this help...


THnx:))

Adl...

Create New Account