DHTML Utopia Modern Web Design Using JavaScript & DOM- P5:In a single decade, the Web has evolved from a simple method of delivering technical documents to an essential part of daily life, making and breaking relationships and fortunes along the way. “Looking something up on the Internet,” by which is almost always meant the Web, is now within reach of almost anyone living in a first-world country, and the idea of conducting conversations and business (and probably orchestras) in your Web browser is no longer foreign, but part of life | Chapter 3 Handling DOM Events Figure . The example smart links Web page. Next let s look at the content of . This code has been assembled from our earlier discussions although it contains some extra code for this particular page. First here s an outline of what the script holds File excerpt function addEvent elm evType fn useCapture . function handleLink e . function cancelClick . function addListeners e . addEvent window load addListeners false And here are those four items in detail 60 Licensed to siowchen@ Creating Smarter Links File function addEvent elm evType fn useCapture cross-browser event handling for IE5 NS6 and Mozilla Gecko By Scott Andrew if evType fn useCapture return true else if var r on evType fn return r else elm on evType fn function handleLink e var el if el if e el if el return while a body el if body return if newwin newwin .checked if true false if e function cancelClick if newwin 61 Licensed to siowchen@ Chapter 3 Handling DOM Events newwin .checked return false return true function addListeners if return var all_links a for var i 0 i i addEvent all_links i click handleLink false all_links i .onclick cancelClick addEvent window load addListeners false Our code includes the now-familiar addEvent function to carry out cross-browser event hookups. We use it to call the addListeners function once the page has loaded. The addListeners .