Need help changing anchor class when clicked

liunx

Guest
Hello, I'm very bad with javascript and would appreciate any assistance...!

I need to change the anchor class of "inactive" to "active" once the user clicks on it:

<li id="cast-bob" class="graphic-text"><a class="inactive" href=http://www.webdeveloper.com/forum/archive/index.php/"javascript:ajaxpage('bios/external.html','subpage-content');" onclick="ajaxpage('bios/external.html','subpage-content');">Jim Bo Bob</a></li>

Is this difficult to do? The sequence would have to be repeated when a user selects another link -- the one above would then be changed to inactive again and the new link to active, etc.How about something like this:<script type="text/javascript">

var currLinkOld;

function currActiveLink(currLinkNew){

if(currLinkOld){
currLinkOld.className = "inactive";
}

currLinkNew.className = "active";

currLinkOld = currLinkNew;

}

</script>

<li id="cast-bob" class="graphic-text"><a href=http://www.webdeveloper.com/forum/archive/index.php/"#" onclick="currActiveLink(this);ajaxpage('bios/external.html','subpage-content');return false;" class="inactive">Jim Bo Bob</a></li>Edit: By the way, are you just using AJAX to load another page in the current page?
 
Back
Top