Need help with html Please

Discussion in 'HTML & Website Design' started by knight1, Feb 19, 2008.

  1. #1
    Hey everyone I have a question? I know the html for making a link with my url: <a href= "landing page url">click here</a>

    but what is the html for making my link after it is clicked to appear in a new window not the same window, and yes I did a search and tried looking it up on search engines as well. Please help, I know it's a newbie question.

    thanks for your time.
     
    knight1, Feb 19, 2008 IP
  2. vijayan

    vijayan Peon

    Messages:
    202
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <a href="http://" target="_blank">LINK HERE</a> Use This bro :)
     
    vijayan, Feb 19, 2008 IP
    knight1 likes this.
  3. knight1

    knight1 Peon

    Messages:
    281
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks, vijayan for the quick response, one rep for you!
     
    knight1, Feb 19, 2008 IP
  4. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Just don't use it : ) Target="blank" sucks for accessiblity. It's also been deprecated-- so depending on what doctype you're using, it may or may not validate (strict will not validate).

    There is also a Javascript solution for people who want to be valid yet open new windows. But again, it really should be avoided-- people love to use the Back button and they do-- most-used button there is. If they want to go back to your page, they'll hit the Back button-- a new window doesn't allow that.
     
    Stomme poes, Feb 19, 2008 IP
  5. dtm32236

    dtm32236 Guest

    Messages:
    320
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #5
    JavaScript:
    function externalLinks()
    {
    if (!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName("a");
    for (var i=0; i<anchors.length; i++) {
     var anchor = anchors[i];
     if (anchor.getAttribute("href") &&
    	 anchor.getAttribute("rel") == "external" ||
    	 anchor.getAttribute("rel") == "external nofollow"
    	)
       anchor.target = "_blank";
    }
    }
    window.onload = externalLinks;
    Code (markup):
    then:

    <a href="http://www.domain.html" rel="external">link</a>

    very accessible, and works as a normal link without JS enabled.
     
    dtm32236, Feb 19, 2008 IP
  6. vijayan

    vijayan Peon

    Messages:
    202
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I know That .but his Request Is To open in New window ..that it.i told him :):D
     
    vijayan, Feb 21, 2008 IP
  7. dtm32236

    dtm32236 Guest

    Messages:
    320
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #7
    use the solution I posted above - i promise that it's the best way to go...

    liek Stomme poes said, don't use target="blank"
     
    dtm32236, Feb 21, 2008 IP
  8. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Yeah but sometimes people come to you asking for blow on a crackpipe or how to lock a puppy in a refrigerator and while it's okay to say "Here's how you could do that" you should also always warn them why it's not a good idea. : )
     
    Stomme poes, Feb 24, 2008 IP
  9. ixl

    ixl Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Can somebody do an actual link using this code for me, say using this url as an example....I have tried to use it and I can't get it to work....obv, I am a total and utterly hopless newbie who really wants to learn.
     
    ixl, Feb 26, 2008 IP
  10. dtm32236

    dtm32236 Guest

    Messages:
    320
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #10
    save the code in an external .js file, and link it in the header.

    see an example on this foremost news page.
    (the external link is the "microban website" one towards the bottom.
     
    dtm32236, Feb 26, 2008 IP