By Stuart Langridge
Discover ways to make extra effective apps, with only one language!
* comprises quite a few hands-on examples
* Explains implementation of real-time apps together with Socket. IO and HTML5, and WebSockets
* Addresses useful Node. js merits from particular layout choices
* contains an interactive on-line part with pattern chapters
* Explains parts of stand out apps together with brevity and benchmarks
- The Web Programmer's Desk Reference
- Building Polyfills: Web Platform APIs for the Present and Future
- Mastering TypeScript
Next, we dig out the image. childNodes; We also know that the tag has one, and only one, child node, and that’s an tag. We know this because we checked that this was the case when we set up the event handler in setupRollovers. ]+)$/, '_over$1'); Images have a src attribute, which you can access through the DOM with the element’s src property. gif) causes the original image to change to the rollover image. gif, causing the original image to reappear. Something for Nothing (Almost) If you look at the code for this modular rollover, you’ll see that it’s divided into parts.
This specially-named rollover image allows us to deduce the name of any rollover image without saving that name anywhere. It reduces the amount of data we have to manage. gif"> However, since oversrc isn’t a standard attribute, this approach would cause your HTML to be invalid. Some of the following script may seem a little opaque: we will be attaching listeners to DOM events to ensure that scripts are run at the appropriate times. If this is confusing, then feel free to revisit this example after you’ve read the discussion of DOM events in the next chapter.
Biz Changing Style Properties Now, the text displayed on-screen for that link will read Google, which matches the link destination that we changed earlier. nodeValue = 'Google'; You may recall that a node’s firstChild property, and childNodes, both refer to the same node; in this case, you can substitute childNodes with success.
Changing Style Properties As we have seen, the attributes that are set on an HTML tag are available as properties of the corresponding DOM node.