Populating a DOM table dynamically with VBScript

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
This topic is 11 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
T V Ganesh
Posts: 6
Last visit: Tue Aug 28, 2012 1:39 pm

Populating a DOM table dynamically with VBScript

Post by T V Ganesh »

Hi,
I am trying to populate a table in a HTA application using VBscript dynamically. I tried to convert Javascript to VBscript but the code does not work. Please help. This is how far I got.

Regards
Ganesh
------------------------------------

Private Sub fnInit()

'Declare variables and create the header, footer, and caption.
oTHead = oTable.createTHead()
oTFoot = oTable.createTFoot()
oCaption = oTable.createCaption()

'Declare stock data that would normally be read in from a stock Web site.
Dim heading(4)
heading(0) = "Stock symbol"
heading(1) = "High"
heading(2) = "Low"
heading(3) = "Close"

Msgbox(heading(2))

Dim stock

stock = Array("ABCD","88.625","85.50","85.81")

'stock(0) = Array("ABCD","88.625","85.50","85.81")
'stock(1) = Array("EFGH","102.75","97.50","100.063")
'stock(2) = Array("IJKL","56.125","54.50","55.688")
'stock(3)= Array("MNOP","71.75","69.00","69.00")

for i = 0 to 3 step 1
'Msgbox(stock(i))
next

'Insert a row into the header.

oRow = oTHead

'oTHead.setAttribute bgColor,"lightskyblue"

'Insert cells into the header row.
for i= 0 to i< UBound(heading) step 1


oCell = oRow.
oCell.align = "center"
oCell.style.fontWeight = "bold"
oCell.innerHTML = heading(i)
Next


'Insert rows and cells into bodies.
for i=0 to i< UBound(stock) step 1

if i < 2 then
oBody = oTBody0
else
oBody = oTbody1
end if

oRow = oBody.insertRow(-1)
for j=0 to j< UBound(stock) step 1

oCell = oRow.insertCell(-1)
oCell.innerHTML = stock(i)
next
next

'Set the background color of the bodies.
'oTBody0.setAttribute("bgColor","lemonchiffon")
'oTBody1.setAttribute("bgColor","goldenrod")

'Insert rows and cells into the footer row.
oRow = oTFoot.insertRow(-1)
oCell = oRow.insertCell(-1)
oCell.innerHTML = "Quotes are for example only."
oCell.colSpan = "4"
oCell.bgColor = "lightskyblue"

// Set the innerHTML of the caption and position it at the bottom of the table.
oCaption.innerHTML = "Created using Table Object Model."
oCaption.style.fontSize = "10px"
oCaption.align = "bottom"
end sub
This topic is 11 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked