Share this page 

Create an HTML fileTag(s): WSH VBScript


set xdoc = CreateObject("MSXML2.DOMDocument")

set html = xdoc.appendChild(xdoc.CreateElement("HTML"))
set list = html.appendChild(xdoc.createElement("UL"))
set item = list.appendChild(xdoc.createElement("LI"))
set text = xdoc.createTextNode("This is item 1")
item.appendChild text

set item = list.appendChild(xdoc.createElement("LI"))
set text = xdoc.createTextNode("This is item 2")
item.appendChild text

set item = list.appendChild(xdoc.createElement("LI"))
set text = xdoc.createTextNode("This is item 3")
item.appendChild text

set ital = xdoc.createElement("I")
ital.appendChild xdoc.createTextNode("italicized")

set item = list.appendChild(xdoc.createElement("LI"))
item.appendChild xdoc.createTextNode("This is ")
item.appendChild ital
item.appendChild xdoc.createTextNode(" text")

xdoc.save "test.html"

and the result is

<HTML>
<UL><LI>This is item 1</LI>
<LI>This is item 2</LI>
<LI>This is item 3</LI>
<LI>This is <I>italicized</I> text</LI></UL>
</HTML>