Wana Change Color of different Links on the same page
-
Hi I am doing a project in ASP.NET and i have 20 links on a page and i want when a user clicks a link its color will be changed and when he click the next one its color will be changed but this color should be different than the color of previous link. So after clicking all the links the color of all the links will be different.plz help me out of it , thankx in advance , regards, tippu
-
Hi I am doing a project in ASP.NET and i have 20 links on a page and i want when a user clicks a link its color will be changed and when he click the next one its color will be changed but this color should be different than the color of previous link. So after clicking all the links the color of all the links will be different.plz help me out of it , thankx in advance , regards, tippu
try this:
var i=0; var arr = new Array(); arr[0] = "blue"; arr[0] = "red"; arr[0] = "yellow"; arr[0] = "#000000"; function doClick(link) { link.style.color = arr[i]; i = i%20; // 20 is the link number }
on page:<a href="..." onclick="doClick(this);">link 1</a> <a href="..." onclick="doClick(this);">link 2</a> <a href="..." onclick="doClick(this);">link 3</a> <a href="..." onclick="doClick(this);">link 4</a> ....
Im not sure but something like this. :doh: