title: Insert current URL into a link using JS and HTML
body: <p>So, Ive read through similar things but I still can't find an answer that applies more closely to what I'm doing. I am attempting to use JS to get the current page URL and append it to a social media sharing link like this:</p>
  
  <pre><code>&lt;a href="http://reddit.com/submit?url=CURRENTPAGE.html; title="This is a post!" target="_blank"&gt;
  </code></pre>
  
  <p>Using Javascript, I've managed to assign the current URL to a variable:</p>
  
  <pre><code>&lt;script&gt;
  var x = window.location.href;
  document.getElementById("smsharing").innerHTML = x;
  &lt;/script&gt;&lt;/p&gt;
  </code></pre>
  
  <p>And I made sure it worked by doing a test display of it. So what exactly is the proper method/syntax for actually putting 'x' in place of CURRENTPAGE.html???</p>
  
  <p>I know this is a STUPID question, but I'm really stumped. Specifics help, because part of the problem is that I have precious little knowledge of JS. Thoughts?</p>