title: object.className or object.getAttribute("className/class")?
body: <p>Between both those : </p>
  
  <h2>Javascript</h2>
  
  <pre><code>function setCss(object, css) {
      return (object.className = css);
  }
  function getCss(object, css) {
      return object.className;
  }
  </code></pre>
  
  <h2>Or</h2>
  
  <pre><code>function getCss2(object)
  {   
      if (object.getAttribute("className")) {
          return object.getAttribute("className");
      }
      return object.getAttribute("class");
  }
  
  
  function setCss2(object, cssclass)
  {        
      if (object.getAttribute("className")) {
          return object.setAttribute("className",cssclass);
      }
      object.setAttribute("class",cssclass);
  }
  </code></pre>
  
  <h2>HTML</h2>
  
  <pre><code>&lt;a href="#" onClick="setCss(this, 'newclass')" /&gt;
  &lt;a href="#" class="something" onClick="alert(getCss(this))" /&gt;
  &lt;a href="#" onClick="setCss2(this, 'newclass')" /&gt;
  &lt;a href="#" class="something" onClick="alert(getCss2(this))" /&gt;
  </code></pre>
  
  <p>Both version seems to work in IE8, FF4, Chrome, Opera and Safari. (<a href="http://jsfiddle.net/7dyzK/" rel="noreferrer">jsFiddle (improved) demo</a>)</p>
  
  <p><strong>Which one is best-usage practice and why?</strong> Did you ever run into any issue with either version?</p>