<!-- JavaScript|CSS:Core code library snippet 5. -->
<!-- Show and hide a region. -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- Code source: http://www.justfigures.co.uk/ -->
<!-- A resource for web developers using XHTML, CSS, JavaScript, PHP -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>View code snippet page</title>
<script language="JavaScript" type="text/javascript">
// function to show and hide a region
function showHide(aRegion) {
var aRegion = document.getElementById(aRegion);
aRegion.style.display = (aRegion.style.display == "none") ? "block" : "none";
}
</script>
</head>
<body>
<p>Show and hide region:</p>
<div style="background-color:#FF6633; padding:10px; font-weight:bold; color:#000000; cursor:pointer"
onclick="showHide('divRegion')">
<p>Click this orange rectangle to show and hide region</p></div>
<!-- region to show and hide, defaults on loading to show incase user has JavaScript disabled -->
<div id="divRegion" style="border:3px solid #FF6633; padding:10px; height:100px">
<p>This is a region to show and hide.</p>
</div>
<p>More content can go here.</p>
</body>
</html>