...

View Full Version : getElementsByTagName - Loop



Serynu
04-15-2005, 07:29 PM
Quick question...how would I make the below code only loop every other one


function change(id)
{
var marked = document.getElementsByTagName('TD');
for(var k=0,mark; mark=marked[k]; k++)
{
if(mark.name==id)
mark.className = 'test';
}
}

...James

Chester
04-15-2005, 08:27 PM
Change k++ to k = k + 2

Serynu
04-15-2005, 08:36 PM
Thanks! :thumbsup: When I first tried that route I went K = +2 lol :p know i know where I went wrong. Thanks again



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum