Listbox in vbscript using an HTML editor Homesite.?

Question by Amit K: Listbox in vbscript using an HTML editor Homesite.?
I have the following code:

I would like to to give a different message for each option selected.

Function Listbox1_onchange()
Select Case Listbox1
Case 1
msgbox “buy”

Case 2
msgbox “sell”

Case else
msgbox “Zero”
End Select

End Function

This does not work. I only get Case Else response. How do I write the code?

Best answer:

Answer by Jason B
Try using IF/ELSE IF statements. Using “Case” isn’t usually the best option.Such as, IF listbox.text = buy THEN msgbox.text = buy

What do you think? Answer below!

Get the book now