Previous Example-|-Next Chapter's Examples-|-Return to Chapter Listing

Example 13.12
Using JavaScript Entities in HTML Tags

[This example works with Netscape Navigator 3 and 4. It will not work in Internet Explorer 3. (It confuses it and you end up with the wrong colors.)]

We've used JavaScript entities to place your colors into the TEXT= and BGCOLOR= attributes of the BODY tag, and change the colors.


We have this in the HEAD: <script language="JAVASCRIPT"> <!-- var sBgColor = prompt("Type the background color you want to use.") var sTextColor = prompt("Type the text color you want to use.") //--> </script> </HEAD> <body text="&{sTextColor};" bgColor="&{sBgColor};">
Previous Example-|-Next Chapter's Examples-|-Return to Chapter Listing