Results 1 to 10 of 10

Thread: Open links of a CLASS in a new tab

  1. #1

    Question Open links of a CLASS in a new tab

    Is there a way to open links of a CLASS in a new tab with javascript since most validators consider "target" to be invalid with the "a" element?
    Lady Aleena

    Mistress of Fantasy's Realm, Lady of the Grey, Bytesaver, wayward daughter of WXity!
    I'm learning Perl. I don't have PHP, ASP, and MySQL.
    Find me on Twitter.

  2. #2
    Senior Member
    England coothead's Avatar
    Join Date
    Feb 2003
    Location
    Chertsey, a small town 25 miles south west of London, England.
    Posts
    633
    Hi there Lady_Aleena

    you may resolve your problem by using this dtd...

    <!DOCTYPE html>

    Further reading:-


    coothead

  3. #3
    Thanks coothead. I have some researching to do it looks like.
    Lady Aleena

    Mistress of Fantasy's Realm, Lady of the Grey, Bytesaver, wayward daughter of WXity!
    I'm learning Perl. I don't have PHP, ASP, and MySQL.
    Find me on Twitter.

  4. #4
    Senior Member
    England coothead's Avatar
    Join Date
    Feb 2003
    Location
    Chertsey, a small town 25 miles south west of London, England.
    Posts
    633
    No problem, you're very welcome.

    coothead

  5. #5
    Administrator
    UK diades's Avatar
    Join Date
    Feb 2001
    Location
    Glasgow, Scotland
    Posts
    15,664
    Blog Entries
    6
    Hi Lady A

    The way that friend Coot mentions is html5 (and is the way to go), if you wish to use xhtml etc., and want the title attribute address it via script onload:
    Code:
    //give the links that you wish to open elsewhere a classname -say - 'external', that way you can pick them out easily and, if you wish, brand them via css as well
    
    var lnks = document.links;
    for ( var i = 0; i < lnks.length;i++)   if(lnks[i].className == 'external') lnks[i].target = '_blank';

  6. #6
    diades, staying with straight HTML seems the better choice, now if only my validator would validate HTML 5.
    Lady Aleena

    Mistress of Fantasy's Realm, Lady of the Grey, Bytesaver, wayward daughter of WXity!
    I'm learning Perl. I don't have PHP, ASP, and MySQL.
    Find me on Twitter.

  7. #7
    Administrator
    UK diades's Avatar
    Join Date
    Feb 2001
    Location
    Glasgow, Scotland
    Posts
    15,664
    Blog Entries
    6
    staying with straight HTML seems the better choice
    I agree wholeheartedly

  8. #8
    Senior Member
    England coothead's Avatar
    Join Date
    Feb 2003
    Location
    Chertsey, a small town 25 miles south west of London, England.
    Posts
    633
    Hi there Lady_Aleena,

    ...now if only my validator would validate HTML 5.
    This is the validator that I use to validate all dtds which includes HTML5...



    coothead

  9. #9
    I guess I should have said my Firefox add-on. *blush*
    Lady Aleena

    Mistress of Fantasy's Realm, Lady of the Grey, Bytesaver, wayward daughter of WXity!
    I'm learning Perl. I don't have PHP, ASP, and MySQL.
    Find me on Twitter.

  10. #10
    Senior Member
    England coothead's Avatar
    Join Date
    Feb 2003
    Location
    Chertsey, a small town 25 miles south west of London, England.
    Posts
    633
    Hi there Lady_Aleena,

    I guess I should have said my Firefox add-on.....
    Well, to be specific, my connection to the...


    ...is via the...



    coothead

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. click links in one frame that open in another
    By Baerwcb in forum Client-side forum
    Replies: 9
    Last Post: 3rd September 2005, 20:12
  2. Partial border problem with links that contain a span class
    By teboose in forum Client-side forum
    Replies: 1
    Last Post: 16th March 2005, 16:13
  3. How to open links in new windows?
    By nattu in forum Client-side forum
    Replies: 3
    Last Post: 26th August 2004, 13:31
  4. Open all links in a new window
    By Matthew Landry in forum Client-side forum
    Replies: 2
    Last Post: 24th September 2002, 05:04
  5. All links open in only one other window
    By ken_web in forum Client-side forum
    Replies: 2
    Last Post: 27th July 2001, 02:34

Tags for this Thread

Bookmarks

Posting Permissions

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