HTML Help Forum Index HTML Help
Please Search for the answer to your question before asking it! Thanks.
 

Is there a way to clear a table and display new table data?
Post a Reply to this Topic Ask a New Question
Click here to go to the original topic
       HTML Help Forum Index -> Others
View previous topic :: View next topic  
Author Message
cygnusx1



Joined: 25 Sep 2007
Posts: 7

Posted: Wed Oct 10, 2007 5:59 am     Is there a way to clear a table and display new table data?  

Using vbscript I have created a 2 column table that displays some data. Is there a way to clear this table data and display new data from a click of a button?

I am very new to using vbscript to display data in html. Without posting the whole script I create the table from a dictionary object like this:

Set oIE = CreateObject("InternetExplorer.Application")
With oIE
.Navigate "file://" & sHtmFile'"about:blank"
.Width = (oIE.Document.ParentWindow.Screen.AvailWidth * .70)
.Height = (oIE.Document.ParentWindow.Screen.AvailHeight * .58)
.Left = (oIE.Document.ParentWindow.Screen.AvailWidth-oIE.Width)/2
.Top = (oIE.Document.ParentWindow.Screen.AvailHeight-oIE.Height)/2
.AddressBar = 0
.FullScreen = 0
.MenuBar = 0
.Resizable = 0
.ToolBar = 0
End With

Do While (oIE.Busy)
Loop

With oIE.Document
.Writeln "<div id=oOutput align=left class=""output"">"
.Writeln "<table border=1 width=100%>"
k = oDict.Keys
i = oDict.Items
For x = 0 to oDict.Count -1
.Writeln "<tr align=left><td style=""width:70%"">" & k(x) & "</td><td>" & i(x) & "</td></tr>"
Next
.Writeln "</table></div></body>"
End With

Should I be using innerHtml or innerText instead of Writeln?

Any help or sugestions would be appreciated.
cygnusx1



Joined: 25 Sep 2007
Posts: 7

Posted: Wed Oct 10, 2007 10:50 am     I got it to work ...somewhat  

I have to delete the rows & then add the new data.
The problem is that the rows do not get removed. If I ONLY remove the rows then they are removed.

Set d = oIE.document.getElementById("oTable")
For x = (d.rows.length -1) To 0 Step -1
d.deleteRow(x)
Next
'if I stop here: all the rows are removed
Call GetData '<this gets the dictionary containing the data>

k = oDict.Keys
i = oDict.Items
For x = 0 to oDict.Count -1
Set oRow = d.InsertRow()
Set oCell = oRow.InsertCell()
oCell.InnerText = k(x)
Set oCell = oRow.InsertCell()
oCell.InnerText = i(x)
Set oRow = Nothing:Set oCell = Nothing
Next

Set d = Nothing
 
 
HOSTING / DESIGN
MAKE MONEY

       HTML Help Forum Index -> Others
Page 1 of 1


Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.19 © 2001, 2002 phpBB Group