Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Wana Change Color of different Links on the same page

Wana Change Color of different Links on the same page

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nethelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    King Shez
    wrote on last edited by
    #1

    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

    G 1 Reply Last reply
    0
    • K King Shez

      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

      G Offline
      G Offline
      gyokusei
      wrote on last edited by
      #2

      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:

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups