1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to give link without HREF?!!

Discussion in 'HTML & Website Design' started by yogi31286, Jan 8, 2010.

  1. #1
    Hello Friends,

    how to give link without href tag?!

    does anybody know about this?
    SEMrush
    Regards,
    YOGI.
     
    yogi31286, Jan 8, 2010 IP
    SEMrush
  2. Kalyse

    Kalyse Peon

    Messages:
    1,221
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can't. You could do a onClick document.location change in JS, but thats totally ridiculous.

    <a href="link" >Anchor</a> isn't hard to do. Why are you so averse to it.
     
    Kalyse, Jan 8, 2010 IP
  3. yogi31286

    yogi31286 Active Member

    Messages:
    193
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #3
    i mean.. if i have one link which is 5 times in a page then...?

    can we make it in CSS?
    i dont know whether css code contains any code for link!!
     
    yogi31286, Jan 8, 2010 IP
  4. Afqam

    Afqam Greenhorn

    Messages:
    87
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #4
    use dreamweaver software its very easy
     
    Afqam, Jan 9, 2010 IP
  5. jaclom_studios

    jaclom_studios Peon

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You can make a php function echoing the href 1 time, then call the function each place you need the link.
     
    jaclom_studios, Jan 9, 2010 IP
  6. Mentalhead

    Mentalhead Active Member

    Messages:
    1,344
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    53
    #6
    Why is it so hard to use href ? It's the basic HTML.
     
    Mentalhead, Jan 9, 2010 IP
  7. kk5st

    kk5st Prominent Member

    Messages:
    3,477
    Likes Received:
    361
    Best Answers:
    28
    Trophy Points:
    335
    #7
    CSS? No.

    Does your editor not have copy and paste functions?

    cheers,

    gary
     
    kk5st, Jan 9, 2010 IP
  8. ThomasTwen

    ThomasTwen Peon

    Messages:
    113
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I think I understand what yogi wants to say... basically, when you want to give 5 div tags the same style, you would use a css class. So, if you want to give 5 a tags the same href, you would also use css.

    In case of links, you cannot use CSS. simply put the same href 5 times. thats the best way to do it.
     
    ThomasTwen, Jan 9, 2010 IP
  9. m7md_cis

    m7md_cis Peon

    Messages:
    91
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Hi,

    In CSS you couldn't remove href, but in javascript you can using code like this:

    <script language="javascript">
    function f()
    {
    window.open('name.htm','width=500,height=400,resizable=yes');
    }
    </script>
     
    m7md_cis, Jan 9, 2010 IP
  10. spiderman3

    spiderman3 Peon

    Messages:
    177
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    i think you should use "href " and dont use java script because it has against the seo, and better for internal backlinks.
     
    spiderman3, Jan 10, 2010 IP
  11. businessheadache

    businessheadache Peon

    Messages:
    84
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    If you can, use the javascript. Then again, Google is good at reading javascripts now.....
     
    businessheadache, Jan 10, 2010 IP
  12. rocking509

    rocking509 Peon

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12

    i have submitted your code in a web page but i don't understand where to link with a button.can u please explain.........
     
    rocking509, Jan 10, 2010 IP
  13. abhijit

    abhijit Notable Member

    Messages:
    4,089
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    215
    #13
    .........you can use javascript to link
     
    abhijit, Jan 10, 2010 IP
  14. pavelx

    pavelx Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    You can't do it without HTML implementation. Javascripts can give you a hand.
     
    pavelx, Jan 10, 2010 IP
  15. ayushdeepsingh

    ayushdeepsingh Member

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #15
    you can use this

    Place this code in under </head>
    
    <script language="javascript">
    
    function link(link) {
    document.location=link;
    }
    </script>
    
    Code (markup):
    link With out href :
    
    <span onclick="link('http://google.com')">Go to Google.com</span>
    
    Code (markup):

    Thanks ,
    Geek Singh
     
    ayushdeepsingh, Jan 10, 2010 IP
  16. rohan_webmaster

    rohan_webmaster Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #16
    JavaScript can be used, but JavaScript menus are not that good when it comes to Google!
     
    rohan_webmaster, Jan 10, 2010 IP
  17. shrek699

    shrek699 Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #17
    example:

    CSS:
    .mylink {url("your url here");}

    HTML:

    <div class="mylink">Your Title</div>

    Thanks
     
    shrek699, Jan 10, 2010 IP
  18. kk5st

    kk5st Prominent Member

    Messages:
    3,477
    Likes Received:
    361
    Best Answers:
    28
    Trophy Points:
    335
    #18
    Why would you?

    No, don't use javascript without compelling reason. Google's not the only visitor to worry about not supporting javascript.

    ??? Odd sentence structure; the meaning is unclear. You can always use html's linking.

    More silliness. That's not even a good javascript implementation. A span cannot obtain focus, so how does that woork from the keyboard?

    Where did you get that?

    gary
     
    kk5st, Jan 10, 2010 IP
  19. ayushdeepsingh

    ayushdeepsingh Member

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #19
    Ok Dude if u need access from keyboard use this :
    Javascript :
    <script language="javascript">

    function link(link) {
    document.location=link;
    }
    </script>
    html :
    <input style="background:transparent; border-style:none" onclick="link('http://google.com')" type="button" value="Go to Google.com" />
     
    ayushdeepsingh, Jan 10, 2010 IP
  20. kk5st

    kk5st Prominent Member

    Messages:
    3,477
    Likes Received:
    361
    Best Answers:
    28
    Trophy Points:
    335
    #20
    Yes, there are any number of ways to use the keyboard, but I was commenting on that particular bit of coding. Now as to your version, it is another silly approach, using poorly structured, non-semantic html, that fails if javascript is either not supported or is disabled.

    If you want to do it correctly, study this bit that uses javascript to open the link in a new page. Without javascript, it still works, but not with the new page embellishment.

    N.B. I don't recommend anyone forcing a new page, but if you're going to mess with your visitor, you might as well do it correctly. ;)
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml"
          xml:lang="en-US"
          lang="en-US">
    <head>
      <meta http-equiv="Content-Type"
            content="text/html; charset=utf-8" />
    
      <title>misc tests</title>
      <style type="text/css">
    /*<![CDATA[*/
      body, html {
        margin: 0;
        padding: 0;
        font: 100% san-serif;
        }
    
      button:focus,
      a:focus {
        background-color: pink;
        color: blue;
        }
    
      /*]]>*/
      </style>
      <script type="text/javascript">
    //<![CDATA[
    
      window.onload = function() {
        var links = document.getElementsByTagName("a");
        for (var i = 0; i < links.length; i++) {
          var rels = links[i].getAttribute("rel");
          if (rels) {
            var testpattern = new RegExp("external");
            if (testpattern.test(rels)) {
              links[i].onclick = function() {
                return !window.open(this.href);  
              }
            }
          }    
        }
      }
      //]]>
      </script>
    </head>
    
    <body>
      <p><a href="http://example.com/"
         rel="external"><button>click or use [enter] key—example.com</button></a></p>
    
      <p><a href="http://google.com/"
         rel="external"><button>click or use [enter] key—google.com</button></a></p>
    
      <p><a href="http://debian.org/"
         rel="external"><button>click or use [enter] key—Debian.org</button></a></p>
    </body>
    </html>
    Code (markup):
    cheers,

    gary
     
    kk5st, Jan 10, 2010 IP