The linked page above, OnClick_Sor.html, uses pre-defined CSS styles and JavaScript onclick event handlers to provide some useful user interaction.
The CSS styles defined in the document head provide the initial display values- display:none (hidden) or display:block (shown) for the paragraph text, unordered list and images appearing at the bottom of the page:
Ex.1: CSS setup for Onclick_Sor.html
[Note: the last two ID entries explicitly declare the default display attribute value, display:block, for the purpose of demonstration.]
Upon the user’s mouse click of the >>Show important works piece of text, JavaScript’s onclick event handler invokes the getElementById() function and changes the values of the display attributes for the three elements involved as follows:
- >>Show important works (#show_e) text to display=none
- >>Hide important works (#hide_e) text to display=block
- The composer’s works list (#important_works) to display=inline
Ex.2: “Show/hide toggling” of text through JavaScript’s onclick event handler
On the flipside of the onclick event, the display attribute values are reversed as follows when the user clicks on >>Hide important works:
- Piece of text, >>Hide important works (#hide_e), is set to display=none
- >>Show important works (#show_e) is reset to display=block
- The composer’s works list (#important_works) is reverted to display=none
The image <div>’s work in much the same way as those for the unordered list. Upon user’s click of the >>Show further illustrations piece of text, the >>Hide further illustrations text (#hide_p) and the images (#images) are set to display=block and display=inline, respectively. Clicking >>Hide further illustrations switches out the class fakelink text and sets the display property of the images to none.
Ex.3: “Show/hide toggling” of text and images
Sams Teach Yourself HTML, CSS and JavaScript by Julie C. Meloni (Sams). Copyright 2012 Julie C. Meloni, 978-0-672-33332-3.
http://en.wikipedia.org/wiki/Fernando_Sor










