title: javascript array returns [object Window] instead of array content
body: <p>I have a problem. I wrote some PHP code that echoes <code>"var pixelArray = [];"</code>. after that it echoes a few variables like this: <code>"var canvas$id = 'can' + $id;"</code>. and also echoes <code>"pixelArray.push(canvas$id);"</code> for each variable.</p>
  
  <p>Now for some reason when i run the script, the array doesn't contain anything.</p>
  
  <p>Can anyone explain to me why?</p>
  
  <p>If you need more information, please tell me.</p>
  
  <p>EDIT:</p>
  
  <p>Here's my full (but still simplyfied) code:</p>
  
  <pre><code>&lt;?php
          $blockCounter = 1;
          $scriptCounter = 1;
          $arrayCounter = 1;
          $size = 32 * 32;
          $yLine = 1;
          while ($blockCounter &lt;= $size)
          {
  
              if ($blockCounter == 32 * $yLine){
                  echo "&lt;canvas id=\"can$blockCounter\" width=\"17\" height=\"17\" style='border:1px solid #777777;'&gt;GET A NEW BROWSER&lt;/canvas&gt;";
                  echo "&lt;br&gt;";
                  $blockCounter = $blockCounter + 1;
                  $yLine = $yLine + 1;
              }
              else{
                  echo "&lt;canvas id=\"can$blockCounter\" width=\"17\" height=\"17\" style='border:1px solid #777777;'&gt;GET A NEW BROWSER&lt;/canvas&gt;";
                  $blockCounter = $blockCounter + 1;
              }
  
          }
          echo "&lt;script&gt;";
          echo "var pixelArray = [];";
          while ($arrayCounter &lt;= $size)
          {
              echo "var name$arrayCounter = 'can' + $arrayCounter;";
              echo "pixelArray.push(name$arrayCounter);";
              $arrayCounter = $arrayCounter + 1;
          }
          while ($scriptCounter &lt;= $size)
          {
              echo "var c = document.getElementById(\"can$scriptCounter\");";
              echo "picoco$scriptCounter = c.style.backgroundColor = \"#000000\";";
              $scriptCounter = $scriptCounter + 1;
          }
          echo "document.getElementById(\"arrayLoc\").innerHTML = pixelArray[0];";
          echo "&lt;/script&gt;";
      ?&gt; 
      &lt;p id="arrayLoc"&gt;&lt;/p&gt;
  </code></pre>