O'Reilly logo

JavaScript™ 1.5 by Example by Kathie Kingsley-Hughes, Adrian Kingsley-Hughes

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required