title: Why javascript can't get the style value but can change it?
body: <p>I need to pass the tag data to the function and read it in that function ,
  I tried to pass the tag via "this" , i could change some style elements but i couldn't read the style data there. What is the problem</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;JS&lt;/title&gt;
  &lt;script&gt;
  function paint(tab){
      window.alert(tab.style.backgroundColor); // It can't show current color
      tab.style.backgroundColor="#000000";
  }
  &lt;/script&gt;
  &lt;style&gt;
  div.vtab {
    background-color:#ff0000;
    height: 80px;
    left: 20px;
    position: absolute;
    width: 80px;
    cursor:pointer;
  }
  &lt;/style&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div onclick="javascript:paint(this)" class="vtab" &gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>