SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    html target new page within ASP variable

    Hi all,

    I'm trying to run a script that checks the data in a database and looks for hyperlinks. I can find the hyperlinks and open them within the existing window but for the life of me I cannot get it to target a new window to open the document in.

    Can anyone please explain? Here is what I'm doing how do I get a target="_blank" into the statement?


    y = "..\..\link.pdf"
    w = "<a href=" & y & ">" & "link" & "</a>"

    this opens the doc in the same window, I need to open it in a new window. I cannot seem to enter the target="_blank" anywhere cos the quotes knacker it.

    thanks

  2. #2
    doing my best to help c2uk's Avatar
    Join Date
    May 2005
    Location
    Cardiff
    Posts
    1,832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    replace " with ' so that it becomes target='_blank' and it should work.

    P.S. I'm not going into an argument that target=blank shouldn't be used any more, it's your decision but remember that it's not future proof.
    Dan G
    Marketing Strategist & Consultant

  3. #3
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the reply, however that just comments out the text

  4. #4
    doing my best to help c2uk's Avatar
    Join Date
    May 2005
    Location
    Cardiff
    Posts
    1,832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    then you didn't do it correctly, this works for me:

    Code ASP:
    w = "<a href='" & y & "' target='blank'>" & "link" & "</a>"

    and as you can see, from the highlighed syntax above, there are no comments
    Last edited by c2uk; Jul 5, 2010 at 07:02. Reason: spelling mistake, target
    Dan G
    Marketing Strategist & Consultant

  5. #5
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh I see

    Thank you very much for taking the time to point this out.

    Much appreciated.


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
  •