Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Dec 2003
    Location
    UK
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts

    replace html tag

    I have information in a database field that includes a url link ie:

    Click <a href="news_view.asp?id=315">here</a>.

    This information is used in 2 places, one is on the main site but the other is in a popup window - so I need it to say:

    Click <a href="javascript:updateParent('news_view.asp?id=315')">here</a>

    How can I use the asp, vbscript REPLACE to do something like:

    replace (recordset.Fields.Item("fieldName").Value,
    "<a href=""***"">",
    "<a href=""javascript:updateParent('news'***')"">")

    Where it ignores whatever the *** is and wraps the tag around it?

    monkey

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    in the database, are you storing the whole a href tag or are you only storing the url?
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    Regular Coder
    Join Date
    Dec 2003
    Location
    UK
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts
    the whole href. I could put identifier around the url like:

    <url>news.asp</url>

    and do a replace on the start and then the end of the tag according to which page is using the information, but I want novice users to add information to the database via a rich text editor, which will add the href tags around the url (I dont have the rich text editor yet, we are in the process of purchasing one, so I may be able to edit the code this adds).

    Your question has me thinking though!! was this along the lines of what you were thinking?!!

    monkey

  • #4
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,065
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Why not use VBScript's string manipulation functions to handle it ?

  • #5
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    It might be easier to work with if you only stored the URL in the database.
    OracleGuy

  • #6
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Originally posted by oracleguy
    It might be easier to work with if you only stored the URL in the database.
    That is what I was hinting at
    then you can just do put the output where you need it

    <a href="<% blah %>">
    <a href="javascript:HM('<% blah %>')">
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]


  •  

    Posting Permissions

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