onBlur和HTML中的onChange属性有什么区别? [英] What is the difference between onBlur and onChange attribute in HTML?

查看:209
本文介绍了onBlur和HTML中的onChange属性有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么时候与其他人打电话?有没有一种情况是onChange会被调用,但onBlur不会被调用?

解决方案 onBlur 事件会在您不必改变其值时从对象移开时触发。


$ b

onChange 事件只有在您更改了字段的值并失去焦点时才被调用。



您可能需要查看 quirksmode介绍事件。当您与浏览器进行交互时,这是一个了解浏览器中发生的事情的好地方。他的书也不错。

When is one called versus the other? Is there a situation were onChange would be called but onBlur would not be called?

解决方案

The onBlur event is fired when you have moved away from an object without necessarily having changed its value.

The onChange event is only called when you have changed the value of the field and it loses focus.

You might want to take a look at quirksmode's intro to events. This is a great place to get info on what's going on in your browser when you interact with it. His book is good too.

这篇关于onBlur和HTML中的onChange属性有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆