title: How do I solve this "Cannot read property 'appendChild' of null" error?
body: <p>I tried to use this code below, which adds buttons in slideshow on my site:</p>
  
  <pre><code>window.onload = function loadContIcons() {
      var elem = document.createElement("img");
      elem.src = "http://arno.agnian.com/sites/all/themes/agnian/images/up.png";
      elem.setAttribute("class", "up_icon");
  
      var id = "views_slideshow_controls_text_next_slideshow-block";
      if (id !== 0) {
          document.getElementById(id).appendChild(elem);
      } else console.log("aaaaa");
  
      var elem1 = document.createElement("img");
      elem1.src = "http://arno.agnian.com/sites/all/themes/agnian/images/down.png";
      elem1.setAttribute("class", "down_icon");
  
      var id1 = "views_slideshow_controls_text_previous_slideshow-block";
      if (id1 !== 0) {
          document.getElementById(id1).appendChild(elem1);
      } else console.log("aaaaa");
  }
  </code></pre>
  
  <p>On the front page, where I have slideshow everything works good, but on the other pages the error <code>Cannot read property 'appendChild' of null</code> occurs.</p>