Help with DHTML

I'm trying to change the color of a link with javascript, but i can't figure out how to do it.
so far, i got this:

[span id="link1"][a href=# onklick="stuff(x);"]Back[/a][/span]

[script]
function stuff(){
document.getElementById('link2').style.color="purple";
}
[/script]

but this doesn't work. I can change other properties, like backgroundColor, but not color. Any ideas why or how to make it work?

You can also use class switching

<html>

<head>

     <style type="text/css">

          .unclicked {

               color:red;

          }

          .clicked {

               color:green;

          }

     </style>



     <script>

          function clickedLink(id){

               var thisLink = document.getElementById(id);

               if(thisLink.className == 'unclicked')

                    thisLink.className = 'clicked';

               else

                    thisLink.className = 'unclicked';

          }

     </script>

</head>

<body>

     <a id="testLink" class="unclicked" href="#" onclick="clickedLink('testLink'); return false;">Google Test Link</a>

</body>

</html>

If you have more than one class it gets more complicated. What are you using this for?

Thanks guys, i got it working. I got another question...
Is there any way to replace a variable with one of a shorter name? I'm currently working with "document.form.hidden.value", but i want to work with something with a shorter name. I guess i'm looking for something like a define or a pointer. Anything like that in javascript?

Don't think so but the reference to the object you are accessing the "value" property for can be set to a variable.

var field = document.formName.fieldName;

field.value = 'value';

I'll often do this in loops and such to clean up the code.