title: JavaScript Error, Missing Name After . Operator
body: <p>I am trying to get the innerHTML of a hidden span. The JavaScript is from an iframe HTML page, and the hidden span resides in the parent page. A different function works when accessing contents of a list from the parent, but I can't seem to get at my span...</p>
  
  <p>WORKS</p>
  
  <pre><code>document.getElementById(parent.genL[i]);
  </code></pre>
  
  <p>DOESNT WORK</p>
  
  <pre><code>document.getElementById(parent."span"+i).innerHTML;
  - SyntaxError: missing name after . operator
  </code></pre>
  
  <p>The above line of code resides in a for loop and as it iterates through i it will grab data from each separate span. the hidden spans start at ID "span1" through upwards of 10-40k different hidden spans.</p>
  
  <p>Anyways, I have a feeling that it has to do something with trying to concatenate the string int i. I assume i is an int anyways. Any thoughts? Thanks so much everyone!</p>
  
  <p>Edit - Words, and added the innerHTML portion to the doesn't work line of code. Not sure if that will be making a difference or not...</p>
  
  <p>Edit2 - Great answers everyone, learned some good syntactical tricks :) I simply moved the parent. portion to the front of the code as reccomend by the comment of mplungjan and the answer from Jacob T. Nielson. For some reason I still got the error using the brackets as suggested, but I will definitely tuck the brackets into my memory for future similar situations!</p>
  
  <pre><code>parent.document.getElementById("span"+i).innerHTML;
  </code></pre>
  
  <p>:)</p>