Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    I think this is a simple question - many thanks

    Hi all,

    I am not sure where i should have posted this question but as javascript is the norm for all queries, so i have posted it here.

    I have a link that is controlled with html and css but upon a link click i want it to open in a new tab/window, rather than it closing my page to display the new page.

    Please help - i love javascript but i am a junior.

  • #2
    Regular Coder
    Join Date
    May 2008
    Location
    Lost in Localhost...
    Posts
    702
    Thanks
    3
    Thanked 43 Times in 42 Posts
    I'm sorry, but to my knowledge this is impossible! It should be coming out soon, but tabbed browsing is up to the browser not the markup. You could force open a window using this:

    Code:
    <a href="http://www.yourlink.com" target="_blank">
    But if you just want to open it in a new tab rather than it doing it automatically. Right click the hyperlink and click 'Open in new tab'.

    Thanks

    (small edit: This thread doesn't belong here)
    Last edited by Millenia; 06-12-2008 at 09:33 PM.

  • #3
    Regular Coder
    Join Date
    Nov 2007
    Location
    Leeds, UK
    Posts
    514
    Thanks
    24
    Thanked 19 Times in 19 Posts
    Not only is the thread in the wrong place you need to name them better soem thing like
    opening in new tab/window

    would be alot easyer for people to help you

    i am not having ago only saying coz ppl dont read threads with daft names

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,080
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Quote Originally Posted by barkermn01 View Post
    Not only is the thread in the wrong place you need to name them better soem thing like
    opening in new tab/window

    would be alot easyer for people to help you

    i am not having ago only saying coz ppl dont read threads with daft names
    Nor those with poor spelling, poor punctuation, textspeak and poor grammar.

  • #5
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by Millenia View Post
    I'm sorry, but to my knowledge this is impossible! It should be coming out soon, but tabbed browsing is up to the browser not the markup. You could force open a window using this:

    Code:
    <a href="http://www.yourlink.com" target="_blank">
    How the document is opened depends on the browser's configuration.

    (small edit: This thread doesn't belong here)
    Technically it can belong here in that the target attribute isn't allowed with certain doctypes, but can be assigned with JavaScript.

    Code:
    <a href="http://www.yourlink.com" id="myLink">
    
    <script type='text/javascript'>
     doccument.getElementById('myLink').target='_blank';
    </script>

  • #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Quote Originally Posted by Arty Effem
    Technically it can belong here in that the target attribute isn't allowed with certain doctypes, but can be assigned with JavaScript.
    May be off topic, but we had a good discussion on this, see http://www.codingforums.com/showthread.php?t=117463
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •