Why is this coming up null
<p>I get a null error on the line this</p>

<pre><code>document.getElementById("Attachment" + x).style.display = "none";
</code></pre>

<p>I really dont want to write this out 5 times.  The line does work if i do this.      </p>

<pre><code>document.getElementById("Attachment1").style.display = "none";
</code></pre>

<p>What am i missing here?  To keep this short i only included the loop where ther error is.</p>

<pre><code>for (x = 0; x &lt; 5; x++)
{

  if(showHideArray[x] &amp;gt; 0) 
  {
    document.getElementById("Attachment" + x).style.display = "none";
  }
  else {
        document.getElementById("Attachment" + x + "If").style.display = "none";
       }

}
</code></pre>
