WEB simple (i think) coding question - arrow/image after a link

Discussion in 'OT Technology' started by Lava Joe, Dec 1, 2007.

  1. Lava Joe

    Lava Joe Guest

    What coding needs to be done to add a tiny image next to each link on a site? Lets assume I already have the image I want to use...how do I get to appear after links on my site?
     
  2. TheDarkHorizon

    TheDarkHorizon \xC0\xFF\xEE

    Joined:
    Sep 26, 2002
    Messages:
    2,396
    Likes Received:
    0
    Location:
    San Francisco, CA
    You can do this using JavaScript.

    Code:
    var link_tags = document.getElementsByTagName('a');
    for(var i = 0; i < link_tags.length; i++) {
      link_tags[i].innerHTML += '<img src="..." style="..." alt="...">';
    }
    
    I would recommend giving the links you want with the arrow a class, and checking each tag against the class.
     
  3. drpepper

    drpepper Active Member

    Joined:
    Nov 13, 2006
    Messages:
    38,076
    Likes Received:
    2
    Location:
    San Antonio
    it can be done in the css file, javascript is not necessary and not advisable.
     
  4. Lava Joe

    Lava Joe Guest

    How is it done in css?
     
  5. Spurious

    Spurious New Member

    Joined:
    Jan 15, 2006
    Messages:
    27,219
    Likes Received:
    0
    Location:
    Houston, Texas Bans: 5
    Background image, affix image to right, pad the anchor on the right the width of the image + 1-2px.
     

Share This Page