Using Hyperlinks to Open a programmed browser page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jonniethecodeprince
    New Member
    • Mar 2007
    • 35

    Using Hyperlinks to Open a programmed browser page

    Hey guys,

    I've been poking through w3schools using their online code tryout pages. I started having fun manipulating browser pages in new windows. I figured out how to open a new window with a button.

    Surely you can do the same with a hyperlink however i'm finding this very difficult. Can anyone help? Thank you.

    [CODE=javascript]<html>
    <head>
    <script type="text/javascript">
    function open_win()
    {
    window.open("ht tp://www.w3schools.c om","_blank","t oolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=400, height=400")
    }
    </script>
    </head>

    <body>
    <form>
    <input type="button", "_blank", value="Open Window" onclick="open_w in()">

    <a href", "_blank", value="Open Window" onclick="open_w in()">
    </form>
    </body>

    </html>[/CODE]
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Jonnie.

    You're looking for the `target` property:

    [code=html]
    <a href="..." target="_blank" >...</a>
    [/code]

    Comment

    • jonniethecodeprince
      New Member
      • Mar 2007
      • 35

      #3
      Well, I tried this and it worked perfectly, Thanks :D

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        From what I've been reading, the "target" attribute has been retired and is nolonger a valid attribute. Or at least "_blank" is no longer valid.
        Originally posted by pbmods
        [code=html]
        <a href="..." target="_blank" >...</a>
        [/code]

        Comment

        • pbmods
          Recognized Expert Expert
          • Apr 2007
          • 5821

          #5
          Heya, Plater.

          Originally posted by Plater
          From what I've been reading, the "target" attribute has been retired and is nolonger a valid attribute. Or at least "_blank" is no longer valid.
          You are correct, and I believe that the strict HTML and XHTML validators will even complain at you if you try to validate the target attribute.

          But until developers learn that opening a new window is a *behavior* and not *structural*, target will stay for awhile.

          Comment

          Working...