Older browsers don't always understand the script tag. If they don't, they'll just ignore it and display your script as if it were part of the body of the (X)HTML document. To keep that from happening, it's a good idea to use commenting to hide scripts from older browsers. To hide scripts from older browsers:
Figure 19.16. This is Mosaic 1. Because it doesn't understand the script tag, it ignores it and prints out the script as if it were regular text. Ugly!
Figure 19.17. This JavaScript script comes from Figure 20.11 on page 326. It preloads the images into cache to ensure speedy rollovers.
Figure 19.18. By commenting out the script, it is hidden from old browsers like this one. (Hey, it may not handle scripts, but this old version of Mosaic displays normal pages without trouble and runs on less than 1Mb of RAM.)
Tips
|