title: why javascript this.style[property] return an empty string?
body: <p>why <code>this.style[property]</code> get an empty string? my code is:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Demo&lt;/title&gt;
      &lt;style type="text/css"&gt;
          #test{
              height:100px;
          }
          .tclass{
              width:100px;
          }
      &lt;/style&gt;
      &lt;script type="text/javascript"&gt;
          function $(ID){
              var element=document.getElementById(ID||'nodId');
              if(element){
                  element.css=css;
              }
              return element;
          }
  
          function css(prop,value){
              if(value==null){
                  return this.style[prop];
              }
              if(prop){
                  this.style[prop]=value;
              }
              return true;
          }
  
          window.onload=function(){
              var element=$("test");
              alert(element.css("height")+","+element.css("width")+","+element.css("background"));
  
              //alert ,,#ccc
          };
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id="test" style="background:#CCC;" class="tclass"&gt;Test&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>this code alert <code>,,#ccc</code>,but i want get <code>100px,100px,#ccc</code>,what's wrong with me? who can help me?</p>
  
  <p><strong>update</strong></p>
  
  <p>i changed the css function,now it can work well:</p>
  
  <pre><code>    function css(prop,value){
          if(value==null){
              var b = (window.navigator.userAgent).toLowerCase();
              var s;
              if(/msie|opera/.test(b)){
                  s = this.currentStyle
              }else if(/gecko/.test(b)){
                  s = document.defaultView.getComputedStyle(this,null);
              }
              if(s[prop]!=undefined){
                  return s[prop];
              }
              return this.style[prop];
          }
          if(prop){
              this.style[prop]=value;
          }
          return true;
      }
  </code></pre>