Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the color of the links with javascript?

Tags:

I want to know how can I manipulate all the links on a page with javascript. I can get elements by id's with document.getElementById(id), but how can I get the links? And also how can I get all elements with a certain classname? I want to change the color of the link and class elements.

I mean these links:

<a href="http://www.google.com">This is a link</a>

And an example for an element with a class:

<span class="link">This is an element with a class</span>

Please no jquery. I want javascript.