+ Start a Discussion
Dileep KumarDileep Kumar 

Javascript and visualforce related problem

Hi All,

<script>
function setVar(){
       var v= document.getElementById("cbid").getAttribute.style.(backgroundColor).value;
       if(v == ''){
           window.alert('ywewdf');
       }else{
           window.alert('welcome');
       }
}
</script>

I am calling this function on button click but i am not getting any alert.

Actually i want to get the background color of  <td>. By using javaScript.

Please help me.

Thanks in advance,

Dileep

Best Answer chosen by Dileep Kumar
Vivek DVivek D
// Try This 
var v = document.getElementById("cbid").style.getPropertyValue("background-color");