193Chapter 14Document Object Model (Msn web hosting) Essentialsfunction imageOn(imgName) { if

193Chapter 14Document Object Model Essentialsfunction imageOn(imgName) { if (document.images) { document.images[imgName].src = onImages[imgName].src; } } The same goes for script statements in the Head that precache the swappable images as thepage loads: if (document.images) { var onImages = new Array(); onImages[ home ] = new Image(50,30); onImages[ home ].src = images/homeOn.gif ; … } This scenario can also provide added content on the page for scriptable browser users byembedding scripts within the body that use document.write()to generate content as thepage loads. For example, the page can begin with a time-sensitive greeting ( Good Morning, Good Afternoon, and so on), while nonscriptable browser users see a standard greetinginside the

Leave a Reply