I am trying to update the contact in this code using an external js file and targeting the "Contact me" node using the DOM: (see my js attempt below.):

<div id="navMain">
<li><a href="/">Hey Brian?</a>||</li>
<li><a href="/travels">photography</a>&raquo;</li>
<li><a href="/travels/china/">china</a>&raquo;</li>
<li><a href="#">Contact me</a></li>
<p><a href="index.php">img</a></p>


external js: (as you can see, I can't even get the alert to work, so I am having trouble traversing the DOM.) Eventually, what I'd like is the js file to setAttribute of the <a href> to my current email.

// contact me email

var getnavmain = document.getElementById("navMain").getElementsByTagName("ul");

var emailtarget = getnavmain.getElementsByTagNames('li')[0].innerHTML;



Can anyone get me started?

Thanks so much.