Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] getElementsByTagName not working ???


  • From: james at southspace.org (James)
  • Subject: [Javascript] getElementsByTagName not working ???
  • Date: Thu Jul 21 07:39:38 2005

Hi,

this code doesn't work but I can't figure out what is wrong with it, it 
should be very simple, there are only 3 lines of script....

Thanks for any help.

James

SCRIPT

var all_links = document.getElementsByTagName('a');
var sitepoint_link = all_links[0];

// using our sitepoint_link variable from above
sitepoint_link.href = "http://www.google.com/";;


/////////////////////////
HTML

<div id="codesection">
<p id="codepara">
</p>
<ul>
<li><a href="http://www.sitepoint.com/"; id="splink">SitePoint</a></li>
<li><a href="http://www.yahoo.com/"; id="yalink">Yahoo!</a></li>
</ul>
</div>