Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DHTML adding Value to list

Status
Not open for further replies.

HebieBug

Programmer
Jan 8, 2001
354
JP
Have been working through some DHTML examples.
One of the examples propogates values to a list box on the selection of a select box. That works fine. I was thinking of taking it to another level based apon what is selected in the list box it will add data to a text box. Does anyone know what I should be ading to the code to do this? Also does anyone know a good in depth site for DHTML?
Code is as follows

Private Sub AddElement(lstlist As Object, strtext As String)
Dim hoeoption As HTMLObjectElement
Set hoeoption = Document.createElement("OPTION")
hoeoption.Text = strtext
lstlist.Add hoeoption
Set hoeoption = Nothing
End Sub


Private Sub basewindow_onload()
Call cmbgroup_onchange
End Sub

Private Sub cmbgroup_onchange()
Do While LstGroup.length > 0
LstGroup.Remove 0
Loop

Select Case cmbgroup.Value
Case "Fruits"
AddElement LstGroup, "Apples"
AddElement LstGroup, "Oranges"
AddElement LstGroup, "Pears"
AddElement LstGroup, "Plum"
Case "Vegtables"
AddElement LstGroup, "lettuce"
AddElement LstGroup, "Carrots"
AddElement LstGroup, "beans"
AddElement LstGroup, "peas:"
Case "Birds"
AddElement LstGroup, "Robin"
AddElement LstGroup, "Hawk"
AddElement LstGroup, "Finch"
End Select
End Sub


Private Function LstGroup_onclick() As Boolean
If LstGroup.Value = "OPTION" Then
MsgBox "hi"
End If
End Function
 
U need to set the .Value to of your OPTION object
Private Sub AddElement(lstlist As Object, strtext As String)
Dim hoeoption As HTMLObjectElement
Set hoeoption = Document.createElement("OPTION")
hoeoption.Text = strtext
hoeoption.Value= strtext
lstlist.Add hoeoption
Set hoeoption = Nothing
End Sub
Hope this working, for me worked just fine
________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top