changing a link url with javascript
<p>This is a javascript menu for a website I'm updating. I want to add a dynamic link (id=IT-LINK) to link to the Italian version of the site. But the URL needs to change depending on which page the viewer is on. Can someone please tell me how to do it!? I'm very new to javascript and am learning by myself. Thanks, Cataldo</p>

<pre><code>window.onload = uline;

var pagename = document.getElementById("TAG").getAttribute("data-name");

function uline()
{
if (pagename == 'HOME' )
document.getElementById(pagename).style.color="#ffffff";
else
document.getElementById(pagename).style.textDecoration="underline";
}


document.write('&lt;DIV CLASS=RIGHT&gt;&lt;B&gt;');

document.write('&lt;a href=\"+link+'\"     id=IT-LINK      &gt;ITALIANO&lt;/a&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;');
document.write('&lt;br&gt;&lt;br&gt;');
document.write('&lt;a href="news.html"     id=NEWSLETTER   &gt;NEWSLETTER&lt;/a&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;');
document.write('&lt;a href="prodotti.html" id=PRODUCTS     &gt;PRODUCTS&lt;/a&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;');
document.write('&lt;a href="bio.html"      id=BIO          &gt;PHILOSOPHY/BIOG&lt;/a&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;');
document.write('&lt;a href="contatti.html" id=CONTACTS     &gt;CONTACTS&lt;/a&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;');
document.write('&lt;a href="home.html"     id=HOME         &gt;HOME&lt;/a&gt;');

document.write('&lt;/B&gt;&lt;/DIV&gt;');
</code></pre>
