PDA

View Full Version : functions.php - comments question


Ely
12-11-2007, 09:26 PM
Hi there,

I wondered if there was an easy way to hack the comments section in functions.php so I can have an alternating color (1 grey, 1 white comment) for example.

Any ideas?

Thanks
Karl

kevincrafts
12-12-2007, 01:16 AM
Instead of hacking the files you can put some javascript on the page. For instance, if you wrap your comments with a <div id="comments"> tag then you can do something like:

var comments = document.getElementById("comments");
var listItems = table.getElementsByTagName("li");
for(i = 0; i < listItems.length; i++){
if(i % 2 == 0){
listItems[i].className = "even";
}else{
listItems[i].className = "odd";
}
}

Ely
12-12-2007, 05:48 AM
Hi Kevein,

Great idea! I will try it out later this morning.

Thanks
Karl