爪哇岛描述语言中挑选框触发事件过程的分析
我们书写了鼠标向下,鼠标向上,点击,输入,改变,聚焦,模糊,按键向下,按键向下事件绑定到了挑选上面,模拟客户选择相关事件的触发流程:
最后发现,触发的过程基本上一样,如果没有选择或者选择的是当前显示的选择权的话,不会触发变化事件,只有在选择不同的选择权时候才会触发变化事件。下面是选择了不同的选择权后触发事件的截图:
我们可以发现,做出改变了可以触发投入事件和变化事件,而如果没有改变或者下拉出现了直接点击别的地方,则不会促发这两个事件:
附上代码:
!DOCTYPE html html lang=' en ' head meta charset=' UTF-8 ' title title/title/head body select name=' id=' input ' option value=' 1 ' 1/option option value=' 2/option option value=' 3/option option value=' 4/option option value=' 5/option/select/body script文档。getelementbyid(' input ').addEventListener('focus ',function(){ console。日志(“焦点”);});document.getElementById('input ').addEventListener('mousedown ',function(){ console。log('鼠标向下');});document.getElementById('input ').addEventListener('mouseup ',function(){ console。log('鼠标向上');});document.getElementById('input ').addEventListener('input '),function(){ console。日志('输入');});document.getElementById('input ').addEventListener('change ',function(){ console。日志(“更改”);});document.getElementById('input ').addEventListener('blur ',function(){ console。日志('模糊');});document.getElementById('input ').addEventListener('click '),function(){ console。日志('点击');});document.getElementById('input ').addEventListener('keydown ',function(){ console。日志(' keydown ');});document.getElementById('input ').addEventListener('keyup ',function(){ console。日志(“向上键”);});document.getElementById('input ').addEventListener('select ',function(){ console。日志(' select ');});/script /html以上就是爪哇岛描述语言中挑选框触发事件过程的分析,如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!