javascript question: possible to know when option items are added to a <select>
javascript question: possible to know when option items are added to a <select># DotNet - 窗口里的风景
c*o
1 楼
i need to get the number of
S*k
2 楼
I guess the simplest way is count the number of options using javascript when the number needs to be shown. A tracing variable may be helpful too. It might depend on how the buttons add/remove options. If the option is added/removed by javascript, a counter may be declared to trace the change. If the option is added/removed in code- behind, a hidden field may be used to keep tracing.
c*o
3 楼
thanks for your answer. 这些东西部分基本上是纯javascript的 只是他们要求用更新count显示当option数量变化 改变option数量的button和link很多处 而且这种select也不少,以后可能还要用 哎 那我现在基本确定没有什么其他办法拉 想到的只能重新做一个类出来封装显示的span和select 结果已有的很多code要改 只能说改完后以后用有些好处 烦死!cry!为什么就没有那么一个事件呢!
counter code-
【在 S***k 的大作中提到】 : I guess the simplest way is count the number of options using javascript : when the number needs to be shown. : A tracing variable may be helpful too. It might depend on how the buttons : add/remove options. If the option is added/removed by javascript, a counter : may be declared to trace the change. If the option is added/removed in code- : behind, a hidden field may be used to keep tracing.