Document Model in VBScript

Once again the differences between JavaScript and VBScript are only related to syntax. Thus examples are not really neccessary in this case either.

Display Text and HTML

Text can be displayed using the document.write and document.writeLn methods.

document.write ("This is some text")

Document Attributes

For instance, set certain colors as shown below in a window onload method.

Sub Window_onLoad
	document.bgColor = "white"
	document.fgColor = "black"
	document.linkColor = "blue"
	document.vlinkColor = "blue"
	document.alinkColor = "red"
End Sub

Last Date Modified

The last date modified for a document can be shown using the document.lastModified attribute. This date can be made more descriptive by using string and date functions as shown below.

document.write "This page was last modified on " & MonthName(Month(document.lastModified)) & " " & Day(document.lastModified) & ", " & Year(document.lastModified)

Document Location

The current document location can be displayed by writing the document.location property to the document.

Back and Forward Buttons

The history object is accessible by use of its back and forward methods.