19 March 2013

Set CSS Using JavaScript

 function setSCC(){  
         var element=document.getElementById("add");        element.className='btn_disable';   
         element.style.height="100px";  
         element.style.width="200px";  
         element.disable=true;  
 }  
 Note : Above function can get the element having id="add". and it will set its css class to "btn_disable" and will set it height and width as specified , as well as it will disable the button.  
 u should have the css included in your page.  
 common.css  
 --------------------  
 .btn_disable  
 {  
    font-family: Arial;  
  font-size:10pt;  
  height:30px;  
     background-color:gray;  
    color:red;  
 }