CreateAnchor

Creates an anchor by passing its arguments (used to be called URL2A), can create anchor to website, email, skype call or phone call with custom target.
Can also pass other Tags using OtherTags, that has anything need to add to the anchor, like "Class=""btn btn-light"""

Function CreateAnchor(url, urlType, Target, OtherTags)
 ' Converts www.Blablawhatever.com to into < a href=http://www.Blablawhatever.com>www.Blablawhatever.com</ a>
 ' urlType can be "Web", "Phone" (and Tel), "Skype" or "email"
 ' OtherTags are anything need to add to the anchor, like "Class=""btn btn-light"""
 Dim strBuf
 strBuf      = url
 If UCase(urlType) = "WEB" Then
  If UCase(Left(url, 4)) = "WWW." Then
   strBuf    = "<a href=""http://" & url & """ Target=""" & Target & """ " & OtherTags
  Else
   strBuf    = "<a href=""" & url & """ Target=""" & Target & """ " & OtherTags
  End If
 ElseIf UCase(urlType) = "SKYPE" Then
  strBuf     = "<a href=""callto:" & url & """ Target=""" & Target & """ " & OtherTags
 ElseIf UCase(urlType) = "PHONE" Or UCase(urlType) = "TEL" Then
  strBuf     = "<a href=""tel:" & url & """ Target=""" & Target & """ " & OtherTags
 ElseIf UCase(urlType) = "EMAIL" Then
  strBuf     = "<a href=""mailto:" & url & """ Target=""" & Target & """ " & OtherTags
 End If
 If strBuf <> url Then strBuf = strBuf & ">" & url & "</a>"
 CreateAnchor   = strBuf
End Function

url, urlType, Target, OtherTags

Views 1161 Downloads 334

'a', 'anchor', 'link', 'url', 'tag', 'href', 'skype', 'email', 'phone', 'www', 'convert', 'create', 'replace', 'change', 'substitute'

ANmarAmdeen
333
Layout+Design Classic ASP
Revisions

v1.0