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

CodeFunctionName
What is this?

Public

Tested

Original Work
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 4,500

Downloads 1,424

CodeID
DB ID