FancyPrairie
Programmer
I have a script that looks like this:
1. The event fires if I code my page like this:
2. It won't fire if I code my page like this:
However, method 2 works for all other controls. Why won't it work for a list box?
I don't want to add the onclick event to the Select statement. Rather I want to assign the onclick event via code. Like this (which works for all controls except for the list box):
Code:
<script language=vbscript>
sub MyListBox_onclick()
msgbox "here i am"
end sub
</script>
1. The event fires if I code my page like this:
Code:
<select id=MyListBox ... [COLOR=blue]onclick=MyListBox_onclick()[/color]>...</select>
2. It won't fire if I code my page like this:
Code:
<select id=MyListBox>...</select>
However, method 2 works for all other controls. Why won't it work for a list box?
I don't want to add the onclick event to the Select statement. Rather I want to assign the onclick event via code. Like this (which works for all controls except for the list box):
Code:
Dim oEvents
set oEvents = getref("MyListBox_onclick")
document.all(strListBoxName).attachEvent "onclick", oEvents