Code advice: Add target='blank' to html string...

Discussion in 'ASP .Net' started by VB Programmer, Aug 7, 2005.

  1. I have a long html string I get from a rich text editor.

    How do I append "target='_blank' to all occurrances of "<A href=..." in the
    long html string easily?

    Is there an easy way, or do I have to go thru the string bit by bit and
    replace it using string functions?

    Thanks.
    VB Programmer, Aug 7, 2005
    #1
    1. Advertising

  2. VB Programmer

    Brock Allen Guest

    String.Replace("<A", "<A target='_blank'") -- it's not perfect, but it might
    get close to what you're looking for.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > I have a long html string I get from a rich text editor.
    >
    > How do I append "target='_blank' to all occurrances of "<A href=..."
    > in the long html string easily?
    >
    > Is there an easy way, or do I have to go thru the string bit by bit
    > and replace it using string functions?
    >
    > Thanks.
    >
    Brock Allen, Aug 7, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cesar Garcia H

    changing link's target to blank page

    Cesar Garcia H, Apr 15, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    496
    Cesar Garcia H
    Apr 15, 2005
  2. TS
    Replies:
    5
    Views:
    4,811
  3. Voihad

    target blank

    Voihad, Jun 27, 2003, in forum: HTML
    Replies:
    0
    Views:
    1,297
    Voihad
    Jun 27, 2003
  4. bPstyles

    Target = Blank vs Top

    bPstyles, Oct 24, 2004, in forum: HTML
    Replies:
    26
    Views:
    15,287
    Matt Clara
    Oct 25, 2004
  5. mohit
    Replies:
    0
    Views:
    529
    mohit
    Jan 23, 2008
Loading...

Share This Page