 <p>setAttribute is broken in IE7 and lower. </p> <p>Use</p> <pre><code>div.className = 'pano_img_cont' </code></pre> <p>instead.</p> <hr> <p>IE's implementation of setAttribute is effectively:</p> <pre><code>HTMLElement.prototype.setAttribute = function (attribute, value) { this[attribute] = value; } </code></pre> <p>… which is fine so long as the attribute name and the DOM property name are the same. <code>class</code>, however, is a reserved keyword in JS so the property is called <code>className</code> instead. This breaks in IE.</p> <p>If you set the property directly, it works everywhere.</p>