title: convert string to Integer in a javascript parameter
body: <p>I have a javascript function that takes two parameters: The first one if the ID of a given html division, and the second one is the content of a row of resultSet (returned from the DB).</p>
  
  <pre><code>    function displayItem(item_ID, content)
      {  
          alert(typeof(item_ID)); // this one returns a String
          el = document.getElementById(item_ID);
          alert(el);
  
        dispArea=document.getElementById("individual");
        dispArea.innerHTML=content; 
  
    }
  </code></pre>
  
  <p>The problem comes when I try to call the function in one of my links:</p>
  
  <pre><code>     &lt;ul id="principle_items"&gt;
                               &lt;!--  &lt;%int x=0; %&gt; !--&gt;
                               &lt;c:set value ="0" var="x" /&gt;
                               &lt;c:forEach var="row" items="${result.rows}"&gt;
                               &lt;c:set value ="${x+1}" var="x" /&gt;
                              &lt;!--  &lt;% out.println("the value of X is " + x +"\n");%&gt;  !--&gt;
  
                               &lt;li&gt;&lt;a id="${x}" href="#" onclick="displayItem(this.id,'${result.rows[8].PRNCPL_NAME}');"&gt;&lt;c:out value="${row.PRNCPL_NAME}"/&gt;&lt;/a&gt;&lt;/li&gt;
                              &lt;/c:forEach&gt;
           &lt;/ul&gt;
  </code></pre>
  
  <p>instead of selecting reslut.rows[8], I want the index to be the integer value of this.id (all my IDs are "1", "2", "3"...)<br>
           onclick="displayItem(this.id,'${result.rows[8].PRNCPL_NAME}');"</p>
  
  <p>when I tried 
          onclick="displayItem(this.id,'${result.rows[this.id].PRNCPL_NAME}');" it did not work obviously because this.id is a string. I know I can use parseInt in Java, but I I am not sure how to do if here within the same statement.</p>