Murach's JavaScript and DOM Scripting
How to script CSS

In this chapter, you’ll learn how to use JavaScript to work with entire style sheets as well as with the styles for a specific element. At the end, you'll see how you can use these skills to add an interactive menu bar with drop-down menus to your applications.

Chapter 16 How to script CSS
How to work with style sheets 556
Three types of external style sheets 556
How to enable and disable style sheets 558
How to add and remove style sheets 560
The Style Selector application 562
The XHTML file 562
The JavaScript files 562
How to modify the style of an element 564
How to set the style of an element 564
How to get the computed style of an element 566
How to change the appearance of an element 568
How to change the position of an element 570
How to get the current position of an element 572
A JavaScript library for working with styles 574
The Menu Bar application 576
The XHTML file 576
The menubar.css file 578
The menubar_library.js file 580
The menubar.js file 586




Murach's JavaScript and DOM Scripting

Learn more about this book

View the table of contents


More about the eBook



Our 100% Guarantee

First, try our books for 90 days. Then, if you aren't completely convinced that our books are the best ones you've ever used, you can return them for a prompt refund...no questions asked.