title: Can I Use an ID as a Variable Name?
body: <p>I find it convenient to set a variable with the same name as an element's id, for example:</p>
  
  <pre><code>randomDiv = document.getElementById("randomDiv");
    randomDiv.onclick = function(){ /* Whatever; */ }
    randomDiv.property = "value";
  </code></pre>
  
  <p>This works in Chrome and Firefox, but not IE8; giving the error <em>Object doesn't support this property or method</em>.</p>
  
  <p>Is creating a variable with a name that matches an element ID wrong (or bad practice) or is this another instance of Internet Explorer acting up?</p>