Javascript Replace Certain Characters of href after the last slash /
<p>I have this a tag</p>

<pre><code>&lt;a id="Link" href="mysite.net/K&amp;N abc 123.html"&gt;Link&lt;/a&gt;
</code></pre>

<p>I need to use JavaScript to remove non alphanumeric characters then replace  spaces with a dash <code>-</code> and lowercase the result.</p>

<p>So everything after <code>/K&amp;N abc 123.html</code> and leave the rest of the href untouched.</p>

<p>The final result would look like this</p>

<pre><code>&lt;a id="Link" href="mysite.com/kn-abc-123.html"&gt;Link&lt;/a&gt;
</code></pre>

<p>I have some code to start but not quite getting it put together right to give the correct result.</p>

<pre><code>var str = document.getElementById("Link").getAttribute("href");
str = str.replace(/\W+/g, '-').toLowerCase();
document.getElementById('Link').setAttribute("href",str);
</code></pre>