166 CHAPTER 6 DECOUPLED NAVIGATION PATTERN (Make my own web site) Even
166 CHAPTER 6 DECOUPLED NAVIGATION PATTERN Even though this discussion of the HTML structure might seem basic and long-winded, it is important to realize that there is a nested structure because HTML event bubbling and how it occurs is directly related to this structure. Looking back at the HTML code, you can see that the div HTML element has the onclick attribute, which implements the onclickevent. From a traditional programming perspective, the defined onclickevent would capture only click events that relate directly to the div element. With event bubbling, the defined event will be triggered for all click events that involve the div element and one of its descendent elements. This means that if the nested button is clicked, the OnClick function is called. Event bubbling is a clever way to define collecting-type events that can be triggered by multiple HTML elements. However, event bubbling works only if the event bubbles. There are some HTML events that will not bubble and are specific to the HTML element. Let s say that an event has been triggered and is bubbling up the chain. If the event is caught and processed, the caught event can be canceled. The way to cancel the event is to return false, as illustrated by the following example:
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.