[Javascript] getElementsByTagName not working ???

Kim Hoogenberg kim.hoogenberg at virgil.nl
Thu Jul 21 07:43:43 CDT 2005


where have you included your script?

Kim

> 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>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript





More information about the Javascript mailing list