Clickable without Anchor <a> Tag possible?

Discussion in 'HTML & Website Design' started by wd_2k6, Sep 7, 2008.

  1. #1
    Hi,

    I think i'm going to get a big NO here but maybe somebody knows somehow! There's always hope.

    Well basically can I make something clickable without the use of an anchor tag?

    It's just i'm adding some JS to a site, and it's causing me to add links that aren't really links to spice up the site, e.g for a collapsable DIV.

    If it is a NO is it such a big problem from SEO or semantic perspectives that i'm adding these anchors that don't link to other pages but are for JS purposes?
     
    wd_2k6, Sep 7, 2008 IP
  2. hadriel

    hadriel Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Easy!



    <span onclick="window.location='http://google.com';">text</span>
     
    hadriel, Sep 7, 2008 IP
  3. Dodger

    Dodger Peon

    Messages:
    1,494
    Likes Received:
    60
    Best Answers:
    0
    Trophy Points:
    0
    #3
    As hadriel said for scripted links.

    As for SE purposes, remember that bots do not read or interpret javascript. Therefore, scripted links are not links in a true sense of the word. This applies to javascripted menu systems as well, in which, one should usually provide another form of navigation via normal anchor links somewhere else on the page.

    If you do not have a need for the links to be 'followed' then don't worry about it. If you do, you can always use hardcoded links on the page (as mentioned) or use the <NOSCRIPT> tag to span the link itself. Everything inside of the NOSCRIPT will render in a browser window if they have scripting disabled or the browser does not support the type of scripting itself. This works for Flash, Javascript, etc.
     
    Dodger, Sep 7, 2008 IP
  4. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thankyou both Hadriel and Dodger for your useful information.

    Hadriel thanks, I used onmousedown rather than onclick, and in addition adding cursor: pointer; inside the CSS does the trick great!

    Dodger thanks for the information on noscript as I will be needing this for sure later to render a different version of a layout generator thingy majig that I am working on for non JS users!
     
    wd_2k6, Sep 7, 2008 IP
  5. Hyphen

    Hyphen Well-Known Member

    Messages:
    464
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    110
    #5
    You just need to use unClock or onMouseDown.
     
    Hyphen, Sep 7, 2008 IP