Remove the brackets from the function name:
select.addEventListener("change", hi, false);
You're calling the function and attaching its result, instead of attaching the function itself.
Edit: Also, as Teemu points out, you're trying to attach to a collection instead of an individual select
item. Try var select = document.getElementsByTagName("select")[0];
- or better still, use getElementById
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…