HTMLTag + HTMLPair

Generate HTML tags with thier parameters as name=value pairs
' Example of usage:
' > HTML Upload Form Function, Create HTML Form Upload
'  htmUploadForm = ""
' > HTML Close button, Creates HTML / Javascript close button
'  htmClose = HTMLTag("button", HTMLPair("style", istyle) & HTMLPair("onclick", "JavaScript:window.close()"), "Close")
' > HTML Input Tag, Creates HTML Input tag
'  htmInput = HTMLTag("input", HTMLPair("type", itype) & HTMLPair("name", iname) & HTMLPair("value", ivalue) & HTMLPair("style", istyle), "")
Two courtesy formulas htmAt and htmTag, the two that were inspiration to create those functions

Function HTMLTag(Tag, Parameters, TagContent)
 Rett      = ""
 If Tag > "" Then
  Rett     = "<" & Tag
  If Parameters > "" Then Rett = Rett & " " & Trim(Parameters) & " "
  If TagContent > "" Then
   Rett = Rett & ">" & TagContent & "</" & Tag & ">"
  Else
   Rett = Rett & "/>"
  End If
  Rett     = Replace(Rett, " ", " ")
  Rett     = Replace(Rett, " ", " ")
 End If
 HTMLTag     = Rett
End Function
Function HTMLPair(ParaName, ParaVal)
 Rett      = ""
 If ParaName > "" Then Rett = " " & Trim(ParaName) & "=""" & Trim(ParaVal) & """ "
 HTMLPair     = Rett
End Function
' Two courtesy formulas htmAt and htmTag, the two that were inspiration to create those functions
Function htmAt(ParaName, ParaVal) ' Attempt1
 htmAt     = HTMLPair(ParaName, ParaVal)
End Function
Function htmTag(Tag, Parameters, TagContent) ' Attempt1
 htmTag     = HTMLTag(Tag, Parameters, TagContent)
End Function

Tag, Parameters, TagContent
Or
ParaName, ParaVa

Views 848 Downloads 329

'UI', 'HTML', 'HTM', 'tags', 'parameters', 'name-value', 'pair'

ANmarAmdeen
333
Layout+Design Classic ASP
Revisions

v1.0