51Chapter 13 .JavaScript Essentials doesn t have an event (Zeus web server)
51Chapter 13 .JavaScript Essentials doesn t have an event handler. Even though the doIt()function is not restricted to any JavaScript version, it is invoked only in browsers capable of JavaScript version 1.1 or later. Listing 13-5: Event Handler Assignments <
Object detection The final methodology for implementing browser version branching is known as object detection. The principle is simple: If an object type exists in the browser s object model, then it is safe to execute script statements that work with that object. Perhaps the best example of object detection is the way scripts can swap images on a page in newer browsers without tripping up on older browsers that don t implement images as objects. In a typical image swap, onMouseOver and onMouseOut event handlers (assigned to a link surrounding an image, to be backward compatible) invoke functions that change the srcproperty of the desired image. Each of those functions is invoked for all scriptable browsers, but you want them to run their statements only when images can be treated as objects. Object models that implement images always include an array of image objects belonging to the documentobject. The document.imagesarray always exists, even with a length of zero when no images are on the page. Therefore, if you wrap the image swapping statements inside an ifconstruction that lets browsers pass only if the document.imagesarray exists, older browsers simply skip over the statements: function imageSwap(imgName, url) { if (document.images) { document.images[imgName].src = url } }From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.