First we provide background on creating and using function pointers. After this introduction, we shift gears and demonstrate how function pointers can be used to solve cross-browser compatibility issues.
To demonstrate we create a setInterval method that works in Netscape Navigator 3.0 and later and Internet Explorer 4.0 and later. While both the 4.0 browsers support a similar setInterval method their are a few key differences. We resolve those differences by overriding Internet Explorer's setInterval implementation with a Netscape 4.0 compatible one. Also, since function pointers are supported by Netscape Navigator 3.0 we also are able to enhance the 3.0 browser with this additional feature.
© 1997-2000 InsideDHTML.com, LLC. All rights reserved.