Oh, wait a minute... let me guess...
Event Details is a memo field that contains some text describing an
event, and also includes email and/or web addresses, and it is these
that you want to identify and turn into hyperlinks. Is that right?
You don't want to turn the whole field into a hyperlink, do you?
If this is the case, and you had explained your problem properly at the
beginning, I would have posted this code several days ago:
<%
function create_links(strText)
strText = " " & strText
strText = ereg_replace(strText, "(^|[\n ])([\w]+?://[^ ,""\s<]*)",
"$1<a href=""$2"" target=""_blank"">$2</a>")
strText = ereg_replace(strText, "(^|[\n ])((www|ftp)\.[^ ,""\s<]*)",
"$1<a href=""
http://$2"" target=""_blank"">$2</a>")
strText = ereg_replace(strText, "(^|[\n
])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)", "$1<a
href=""mailto:$2@$3"">$2@$3</a>")
strText = right(strText, len(strText)-1)
create_links = strText
end function
function ereg_replace(strOriginalString, strPattern, strReplacement)
' Function replaces pattern with replacement
dim objRegExp : set objRegExp = new RegExp
objRegExp.Pattern = strPattern
objRegExp.IgnoreCase = True
objRegExp.Global = True
ereg_replace = objRegExp.replace(strOriginalString, strReplacement)
set objRegExp = nothing
end function
%>
which you call like this:
<%
Response.Write create_links(myString)
%>
In fact, I tend to use it on data prior to inserting it into a
database, which means the function isn't called every time a user
requests a page which contains text that might or might not have email
or web addresses in it that need to be turned into links. Does your
InsertLinks() function do the same thing?
--
Mike Brind
Mike said:
Or, you could have used the obvious:
<a href=""><%=mystring%></a>
There is no such thing as a link that isn't clickable, as Evertjan has
already pointed out. There is a string written to a page, or there is
a string encapsulated in an <a href> tag which forms a hyperlink. As I
said - basic html.
--
Mike Brind
Ok. I went about this a different way. I had an old script that changed
spaces, <br>'s and stuff... so i went with that, then used a little
html,
and the result is this, and it works.
<br>
<font face="Verdana,Arial" size="1"><% myString =
Replace(Rs("Event_Details"), vbCrLf, " <br> ")%><%=
InsertHyperlinks(myString)%><br>
</font></p>
thanks again.
Bob, thanks for replying, and what it was showing in the source, was
the
link without it being clickable. but with this code it is.
Thanks again.
I give up. Seems like this one is too easy, yet it keeps eluding me.
Hey gang.
i have this
Response.Write Replace(Rs("Event_Details") & " ", vbCrLf, "<BR>") &
vbCrLf
coming from access db.
how can i get that to make a hyperlink clickable as well??
Thanks