教程地址:JavaScript事件

事件对象的额外属性

阻止默认行为:错误表单阻止提交

Conclusion

In this chapter we've learned what events are, how to listen for events, and how to respond to them.

You've seen by now that elements in a web page can be nested inside other elements. For example, in the Preventing default behavior example, we have some text boxes, placed inside <div> elements, which in turn are placed inside a <form> element. What happens when a click event listener is attached to the <form> element, and the user clicks inside one of the text boxes? This is called event bubbling and is the subject of the next chapter.