title: Convert Onclick to addEventListener
body: <pre><code>for(var i=1;i&lt;=s;i++){if(e[r]&lt;0&amp;&amp;n&lt;=0)
  {n=Math.abs(e[r])-1;r++}
  else if(n&gt;0){n--}else{t=e[r];r++}
  var o=document.createElement("div");
  o.style.height=t+"px";o.className="thumbnail";
  o.id="thumb"+i;
  o.setAttribute("onclick","Viewer.goToPage("+i+");");
  </code></pre>
  
  <p>I'm trying to convert onclick into addEventListener due to CSP restrictions in Firefox OS but not getting success.</p>