Next: httpdutl.bas
Up: Code Listing
Previous: Code Listing
'
' Author: Terence Kelly
' Date: 8 September 1995
'
' This module contains utilities to do HTML things.
' It is intended for use in conjunction with my Web
' work with Professor Littman.
'
' 1 2 3 4 5 6 7
'234567890123456789012345678901234567890123456789012345678901234567890
'
Function HTML_document (ByVal title$, ByVal body$) As String
'
' Return an HTML document with the given contents in the
' title and body sections.
'
R$ = "Content-type: text/html" & CRLF() & CRLF() & "<html>"
R$ = R$ & CRLF() & HTMLHead(title$) & CRLF() & "<body>" & CRLF()
R$ = R$ & body$ & CRLF() & "</body>" & CRLF() & "</html>" & CRLF()
HTML_document = R$
End Function
Function HTML_H1 (ByVal H$) As String
'
' Return a string containing the argument within H1 tags
'
HTML_H1 = "<h1>" & H$ & "</h1>"
End Function
Function HTML_H2 (ByVal H$) As String
'
' Return a string containing the argument within H2 tags
'
HTML_H2 = "<h2>" & H & "</h2>"
End Function
Function HTML_HR () As String
'
' Output a <hr> tag
'
HTML_HR = CRLF() & "<hr>" & CRLF()
End Function
Function HTML_href (ByVal URL$, ByVal Text$) As String
'
' Return an HTML hypertext link to the given URL displaying
' the given text.
'
R$ = "<a href=" & Chr$(34) & URL$ & Chr$(34) & ">"
R$ = R$ & Text$ & "</a>"
HTML_href = R$
End Function
Function HTML_pre (ByVal P$) As String
'
' Output the given string within <pre> tags
'
HTML_pre = "<pre>" & CRLF() & P & CRLF() & "</pre>" & CRLF()
End Function
Function HTMLHead (ByVal title$) As String
'
' Output an HTML header containing the given Title
'
R$ = "<head>" & CRLF() & "<title>" & title & "</title>"
R$ = R$ & CRLF() & "</head>" & CRLF()
HTMLHead = R$
End Function