title: How to add a value of a dynamic javascript variable in a function name that is in an another variable
body: <p>I don't know how to add a value of a dynamic JavaScript variable in a function name at the <code>&lt;a href&gt;</code>.</p>
  
  <p>For Example:</p>
  
  <pre><code>var x =  document.getElementById('example').value // value is 6 now
  &lt;a href="javascript:function6();"&gt;+&lt;/a&gt;
  </code></pre>
  
  <p>with <code>document.write</code> it should look like this:</p>
  
  <pre><code>document.write('&lt;a href="javascript:function"' + x + '();"&gt;Something&lt;/a&gt;'
  </code></pre>
  
  <p>The issue is, that I have to use inner.html.</p>
  
  <p>I have such code:   </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
     function count(){ 
         var x = 1;
         document.getElementById('count').value = ++x;  
         var z = x + 4;
     }
  
     var ex = ("&lt;a class=\"button6\" href=\"javascript:anotherfunction\" + z + '()'&gt;Anything else&lt;\/a&gt;");
  
     function new(){
         document.getElementById("add").innerHTML += ex
     }
  &lt;/script&gt;
  &lt;table id="add"&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;a class="button6" href="javascript:new();count();"&gt;+&lt;/a&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>The "+"-link should add an another link with the counter value in the function name at the href just like this:</p>
  
  <pre><code>&lt;a class="button6" href="javascript:anotherfunction6();"&gt;+&lt;/a&gt;
  </code></pre>
  
  <p>The first "+"-link in the code should add an second link with the counter value in the function name at the href, so after clicking the "+"-link two times the added code should be like this:</p>
  
  <pre><code>&lt;a class="button6" href="javascript:anotherfunction6();"&gt;+&lt;/a&gt;
  &lt;a class="button6" href="javascript:anotherfunction7();"&gt;+&lt;/a&gt;
  ...
  </code></pre>
  
  <p>But it doesn't work.</p>