# Changing font color

**URL:** <https://forum.kirupa.com/t/changing-font-color/276332>\
**Category:** web dev\
**Created:** [November 25, 2008, 10:25pm UTC](https://forum.kirupa.com/t/changing-font-color/276332 "2008-11-25T22:25:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpearson311](https://avatars.discourse-cdn.com/v4/letter/j/977dab/32.png) [@jpearson311](https://forum.kirupa.com/u/jpearson311)\
**Post date:** [November 25, 2008, 10:25pm UTC](https://forum.kirupa.com/t/changing-font-color/276332/1 "2008-11-25T22:25:53Z")

</div>

I have some links that are styled with css, but am trying to set their states with javascript when clicked. I am using the below code:

```auto

var curActive;

function styleActiveLink(section){
    
    //Revert to non-active styles
    if(typeof(curActive) != "undefined"){
        
        var curItem = document.getElementById(curActive);
        curItem.style.backgroundImage = "none";
        curItem.style.paddingLeft = "0px";
        curItem.style.color = '#7e7e7e';
    }
    
    //Styles for active section
    var curSection = document.getElementById(section);
    curSection.style.backgroundImage = "url(images/services_arrow.jpg)";
    curSection.style.paddingLeft = "20px";
    curSection.style.backgroundRepeat = "no-repeat";
    curSection.style.backgroundPosition = "left";
    curSection.style.color = '#c51500';
    
    curActive = section;
}

```

Everthing is working with the exception of the color property. Can anyone tell me why the font color is not changing? Thanks!

JPearson311
