0

So far I have this:

var colors = [ 'BlueViolet', 'CadetBlue', 'Coral', 'Crimson', 'DarkGoldenRod', 'DarkOliveGreen'],
    a = document.getElementById('colorthis').getElementsByTagName('a');

for(var i = 0; i < li.length; i++) {
    var elem = a[i],
        color = colors[0];
    elem.style.color = color;
    colors.push(color);
    colors.shift();
}

Apprently this would work, but is there a way for me to apply this to the pseudo class of:

a:active
a:visited

Is this something jquery's .each could do?

4

1 回答 1

1

try the following

$.each(colors,function(key,val){
alert(key+ " "+val);
});
于 2013-03-30T13:53:12.393 回答