JavaScript and CSS

So, you've seen some CSS in action. Think it's cool, eh? Well, combining it with JavaScript takes it to a whole new level!

The trick with a CSS/JavaScript combination is to realize that what you are always doing is using JavaScript to change CSS attribute values. Now, do this after the page has loaded and the user sees things change on the page right in the browser—and that's Dynamic HTML!

Let's give you the opportunity to dive straight in with an example based on the text color example you saw earlier.

NOTE

This example works only in Internet Explorer 4 and higher.

 <html> <head> <title>A Simple Page</title> <script language="JavaScript"> <!-- Cloaking device on! // Cloaking device off --> </script> </head> <body> <h1 style="color:red">Welcome ...

Get JavaScript™ 1.5 by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.