|
This example produces expanding and contracting outlines. This allows you to have headings or short paragraphs on a page that expand to give more information when you click on them. It is a good way to save space; you can hide most of the content and give users the option to display only the information they want. You need one style for the heading and one for the text that you want to expand, a JavaScript that does the clever stuff, and you need to assign the correct html to the heading and the expansion text. This code does the trick: <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Expanding and contracting headings</title> <style type="text/css"> <!-- .parent {color :blue; font-family: Verdana, Arial, sans-serif; font-size: 10pt; font-weight: bold; cursor: hand;} .child {display: none; font-family: Verdana, Arial, sans-serif; font-size: 10pt; position: relative;} --> </style> <script language="JavaScript"> <!--// function mouseon() { var el = event.srcElement; var thisclass = event.srcElement.className; if (thisclass=="parent") { el.style.color = "red"; } } Try it and see. |
More information Changing the appearance of links Changing pictures with the mouse Expanding and contracting outlines Displaying a message in the status bar |