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>
- Follow-Ups:
- [Javascript] getElementsByTagName not working ???
- From: Flavio Gomes
- [Javascript] getElementsByTagName not working ???
- From: Hassan Schroeder
- [Javascript] getElementsByTagName not working ???
- From: Kim Hoogenberg
- [Javascript] getElementsByTagName not working ???
- From: Roger Roelofs
- [Javascript] getElementsByTagName not working ???
- Prev by Date: [Javascript] How can I change this using CSS
- Next by Date: [Javascript] getElementsByTagName not working ???
- Previous by thread: [Javascript] How can I change this using CSS
- Next by thread: [Javascript] getElementsByTagName not working ???
- Index(es):