www.webdeveloper.com
Results 1 to 10 of 10

Thread: "target" replacement?

  1. #1
    Join Date
    Oct 2003
    Posts
    215

    "target" replacement?

    Been working on getting a page xhtml valid. Here's the error:

    there is no attribute "target".

    ...this/is/the/url" target="_blank">
    Is there a valid xhtml attribute to open a link in a new window?

  2. #2
    Join Date
    Oct 2003
    Posts
    215
    Found it.

    Code:
     rel="external

  3. #3
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    No, but a JavaScript solution is possible. You decide if this is cheating the Validator or not.
    At least 98% of internet users' DNA is identical to that of chimpanzees

  4. #4
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Quote Originally Posted by Dudsmack
    Found it.

    Code:
     rel="external
    That doesn't do the same as target.
    At least 98% of internet users' DNA is identical to that of chimpanzees

  5. #5
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Quote Originally Posted by Fang
    No, but a JavaScript solution is possible. You decide if this is cheating the Validator or not.
    It most certainly is cheating.
    From the HTML 4.01 Specification
    HTML documents are constrained to conform to the HTML DTD both before and after processing any SCRIPT elements.
    http://www.w3.org/TR/html401/interac....html#h-18.2.4
    Use instead
    Code:
    <a href="http://www.w3.org/" onclick="window.open (this.href, 'child'); return false">W3C</a>
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  6. #6
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    Opening in a new window is a behaviour and not content which is why the target attribute has been removed.

    HTML for content
    CSS for appearance
    Javascript for behaviour

    Therefore the correct way to code something to open in a new window is using the javascript window.open command as Charles has indicated.
    Stephen

  7. #7
    Join Date
    Sep 2005
    Posts
    137
    The only problem with that is it's open to being stopped by popup blockers.

  8. #8
    Join Date
    May 2005
    Location
    Northern Indiana
    Posts
    597
    Quote Originally Posted by sincilite
    The only problem with that is it's open to being stopped by popup blockers.
    How is that different from any other method? My old blocker made no differentiation between windows opened with a target="_blank", window.open or any other method of opening a new window- it stopped them all.

  9. #9
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Quote Originally Posted by sincilite
    The only problem with that is it's open to being stopped by popup blockers.
    That's not a problem it's a feature, and a welcome one at that.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  10. #10
    Join Date
    Jan 2007
    Posts
    5
    I am trying to use the "Multiple Users Prompt" to password protect my private family trees from within a frame of the Genopro html report but can't get the link to open in a new window with the usual "target=_blank" as I always get errors on the page and the frame in Genopro is not appropriate for a new tree. This is the full script :-
    <head>
    <!-- Begin
    function LogIn(){
    loggedin=false;
    username="";
    password="";
    username=prompt("Username:","");
    username=username.toLowerCase();
    password=prompt("Password:","");
    password=password.toLowerCase();
    if (username=="guest" && password=="login") {
    loggedin=true;
    window.location="home-page.html";
    }
    if (username=="guest2" && password=="login2") {
    loggedin=true;
    window.location="home-page2.html";
    }
    if (loggedin==false) {
    alert("Invalid login!");
    }
    }
    // End -->
    </SCRIPT>
    </head>
    <body>
    <center>
    <form><input type=button value="Login!" onClick="LogIn()"></form>
    </center>

    <p><center>
    <font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
    by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
    </center><p>

    <!-- Script Size: 1.29 KB -->
    </body>
    Please can anyone help ?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles