title: Using a Javascript variable in HTML <a> link
body: <p>My code goes something like this -</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" 
      "http://www.w3.org/TR/html4/strict.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
      &lt;title&gt;&lt;/title&gt;
  
  
      &lt;script type='text/javascript'&gt;
  
      var random_generator;
      document.write('Random Selection: ');
      var arr=['One','Two','Three','Four','Five','Six','Seven','Eight','Nine','Ten'];
      var randomnumber=Math.floor(Math.random()*10);
      random_generator=arr[randomnumber];
      document.write(random_generator+ '&lt;br&gt;');
  
  
      &lt;/script&gt;
  
  &lt;style type="text/css"&gt;
  
  &lt;/style&gt;
  &lt;a href='www.xyz.com/Index1/Index2/Variable/Index4'&gt;Good Morning&lt;/a&gt;
  &lt;/head&gt;
  &lt;body&gt; 
  &lt;/body&gt;  
  &lt;/html&gt;
  </code></pre>
  
  <p>In place of Variable in the  tag, I want to use random_generator Javascript variable. How do I do that? Thanks in Advance.</p>
  
  <p>NOTE: random_generator doesn't replace the entire link. Only a part of the link (/Variable/). Depending on this value, the user is shown different pages.</p>