This Month
Date 04-02-2012
Time 10:23:00

AW! Google Gadgets

Switch Content Script
from Dynamic Drive

Abstract

Simple website utility from Dynamic Drive, a source of a small range of useful and relible scripts. It hides and reveals content as the reader wants it, adding to the interactivity of your page. Switch Content script — © Dynamic Drive (www.dynamicdrive.com). This notice must stay intact for legal use. Last updated April 2nd, 2005. Visit http://www.dynamicdrive.com/ for full source code.
Page Tags: Dynamic Drive utility code, Google Gadgets
Site Tags: Solomon argue morality Israelites svg art contra Celsum Joshua God’s Truth Marduk Site A-Z dhtml art Conjectures Judaism Persecution crucifixion Christmas
Loading
In the brief period since the forest ape took to the water, not more than 6.7 million years ago, intelligence emerged.
Who Lies Sleeping?

Expand-Contract Script

© Dynamic Drive 2004-5. Contents Updated: Sunday, 21 December 2008

Dynamic Drive has some excellently reliable free DHTML and javascript scripts, some of which we use. This is one of them, a javascript for hiding content until the reader wants to see it, and is therefore interactive—just as websites should be.

▼ Contract All | ▲ Expand All

Data

This script works with virtually any content on your page to make them expandable. The two steps required are:

1. Create the header that will expand a content when clicked on. Here's an example:

<h2 onClick="expandcontent('sc1')"
style="cursor:hand; cursor:pointer"> A Heading</h2>

The part in red is the only required portion—everything else you can customize, from the header's style to even the tag used (ie: <img> instead of <h2>).

2. Specify the content that will be associated with the above and become expandable:

<div id="sc1" class="switchcontent"> JavaScript is a scripting language originally developed by Netscape..... </div>

Only the portion in red is necessary. The ID attribute used above (ie: sc1) can be arbitrary, but must match the “sc1” specified within the header of step 1) so that the header knows which content it should expand. Now, feel free to swap the <DIV> tag used to surround your content with a different container tag, such as <span>, <p> etc.

That's It

When the page first loads, by default the participating content is contracted. The user has to click to expand it. To make any content visible from the start, use the CSS “display” property:

<div id="sc1" class="switchcontent" style="display:block"> " </div>

And that's it. The script is adaptable, and easily integrated into any apge.

Specifying the “expand” and “contract” symbols

You can use different symbols in your headers, depending on the contracted or expanded state of the DIV content. In the script of Step 1 are two variables, one for each symbol. HTML is supported, so you can specify a simple “+” and “-” symbol, use character codes, as we have here, ▲ and ▼, or use images: "<img src='a.gif'>" and "<img src='b.gif'>"

Having created your symbols, insert the code:

<span class="showstate"></span>

inside each of your header HTML (code of Step 2, as shown). The script does the rest!


Last uploaded: 20 December, 2010.

Give Us Your Advice on This Page

If you think this page could be improved, give us your advice. You can use various methods:

Other Websites or Blogs

Short Responses and Suggestions

* Required.  No spam




New. No comments posted here yet. Be the first one!

Before you go, think about this…

In The Decline and Fall of the Roman Empire, Edward Gibbon writes about the apex of Christendom in the dark ages:
In the revolution of ten centuries, not a single discovery was made to exalt the dignity or promote the happiness of mankind. Not a single idea had been added to the speculative systems of antiquity, and a succession of patient disciples became in their turn the dogmatic teachers of the next servile generation.

Support Us!
Buy a Book

Support independent publishers and writers snubbed by big retailers.
Ask your public library to order these books.
Available through all good bookshops

Get them cheaper
Direct Order Form
Get them cheaper


© All rights reserved

Who Lies Sleeping?

Who Lies Sleeping? cover
Who Lies Sleeping?
The Dinosaur Heritage and the Extinction of Man
ISBN 0-9521913-0-X £7.99

The Mystery of Barabbas

Mystery of Barabbas cover
The Mystery of Barabbas.
Exploring the Origins of a Pagan Religion
ISBN 0-9521913-1-8 £9.99

The Hidden Jesus

Hidden Jesus cover
The Hidden Jesus.
The Secret Testament Revealed
ISBN 0-9521913-2-6 £12.99

These pages are for use!

Creative Commons License
This work by Dr M D Magee is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
Permissions beyond the scope of this license may be available at http://www.askwhy.co.uk/.

This material may be freely used except to make a profit by it! Articles on this website are published and © Mike Magee and AskWhy! Publications except where otherwise attributed. Copyright can be transferred only in writing: Library of Congress: Copyright Basics.

Conditions

Permission to copy for personal use is granted. Teachers and small group facilitators may also make copies for their students and group members, providing that attribution is properly given. When quoting, suggested attribution format:

Author, AskWhy! Publications Website, “Page Title”, Updated: day, month, year, www .askwhy .co .uk / subdomains / page .php

Adding the date accessed also will help future searches when the website no longer exists and has to be accessed from archives… for example…

Dr M D Magee, AskWhy! Publications Website, “Sun Gods as Atoning Saviours” Updated: Monday, May 07, 2001, www.askwhy .co .uk / christianity / 0310sungod .php (accessed 5 August, 2007)

Electronic websites please link to us at http://www.askwhy.co.uk or to major contents pages, if preferred, but we might remove or rename individual pages. Pages may be redisplayed on the web as long as the original source is clear. For commercial permissions apply to AskWhy! Publications.

All rights reserved.
Website Summary

AskWhy! Blogger

↑ Grab this Headline Animator

Add Feed to Google
The Wisdom of Carl
Psychoanalysis is not a very self-critical profession, but Carl Sagan points out many of its practitioners have MD degrees. Most medical curricula include exposure to scientific results and methods, but mental health providers in America are more likely by about two-to-one to be social workers than either psychiatrists or PhD psychologists. Many dealing with abuse cases have little acquaintance with science and little formal training in scientific method, statistics, or human fallibility. Most consider themselves carers whose duty is to support their patients, and that means believing them, not to be sceptical, to question them or to raise doubts, with a view to getting at the truth.