Click to show and hide DIV content (IE only) : div « Tags « HTML / CSS






Click to show and hide DIV content (IE only)

     


<!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">
<head>
<title>ASR Outfitters</title>
<style type="text/css">
<!--
body {font-size : 110% }
h1, h2, h3 {font-family : "Comic Sans MS"}
h1 {font-size : 180% ; font-weight : bold}
-->
</style>
<script type="text/javascript" language="javascript">
<!--
function contactus() { 
   if (document.all.contactus.style.display=="none") 
      (document.all.contactus.style.display="block");
    else 
      (document.all.contactus.style.display="none"); 
   }
function otherstuff() { 
   if (document.all.otherstuff.style.display=="none") 
      (document.all.otherstuff.style.display="block");
   else 
      (document.all.otherstuff.style.display="none"); 
   }
function whatwedo() { 
   if (document.all.whatwedo.style.display=="none") 
      (document.all.whatwedo.style.display="block");
   else
      (document.all.whatwedo.style.display="none") ; 
   }
function whathere() {
    if (document.all.whathere.style.display=="none") 
       (document.all.whathere.style.display="block");
    else 
      (document.all.whathere.style.display="none"); 
   }
// -->
</script>
</head>
<body>
<p><a href="tour.html">t</a></p>
<hr />
<h2 onclick="whathere()">click me</h2>
<div id="whathere" style="display:none">
<p>This is a test. </p>
<ul>
<li><a href="">This is a test. </a>.</li>
<li><a href="">This is a test. </a>.</li>
<li><a href="">This is a test. </a>.</li>
<li><a href="">This is a test. </a>.</li>
<li><a href="">This is a test. </a>.</li>
</ul>
</div>
<h2 onclick="whatwedo()">click me</h2>
<div id="whatwedo" style="display:none">
<p>This is a test. <a href="">This is a test. </a>.</p>
</div>
<h2 onclick="otherstuff()">click me</h2>
<div id="otherstuff"  style="display:none">
<ul>
<li>This is a test. <i>This is a test. </i>. <a href="http://www.a.com/">
   http://www.a.com/</a>.</li>
<li>This is a test. 
<ol>
<li>This is a test. </li>
<li>This is a test. </li>
<li>This is a test. </li>
</ol>
</li>
</ul>
</div>
<h2 onclick="contactus()">click me</h2>
<div id="contactus"  style="display:none"> 
<p>This is a test. 
<a href="mailto:a@r.com">
   a@r.com</a>.
   </p>
</div>
</body>
</html>

   
    
    
    
  








Related examples in the same category

1.'div' Example
2.DIV color: white;
3.div::before content: "I said, \"Hello, world!\"";
4.div::before color: white;
5.div with id selector
6.Using div as img tag
7.This div stretches across the whole window.
8.div content: "This string is placed inside of all div elements.";
9.Using div to layout table elements
10.Div element
11.Div color: #676767;
12.Div based multi-column
13.Div color: red;
14.Div color: #FEF9ED;
15.DIV overflow: hidden;
16.DIV as container
17.Using two Nested DIV to do the layout
18.DIV color: #9D9C6A;
19.DIV color: #505050;
20.Nested div box
21.Default layout for div tags
22.The dialogue div element is aligned vertically and horizontally, no matter what the size of the browser window.
23.div for header and body
24.Grouping Elements Using the div Element
25.Two boxes with div tags
26.HTML divisions
27.Division tag
28.div with id style
29.div with class name
30.div.className (tag.className)
31.div in a div with class name
32.Use DIV as wrapper
33.Click to show or hide DIV section
34.Block divider
35.'nowrap' is similar to the 'pre' element