Show and hide elements (IE)
|
|
<html> <head> <title>A Simple Page</title> <script language="JavaScript"> <!-- function checkBold() { var thistag, parentTag; thistag = window.event.srcElement.tagName; parentTag = window.event.srcElement.parentElement.tagName;
if (thistag == "H1" && parentTag == "BODY") {
if(document.all(window.event.srcElement.id + "p").style.display == "none") { document.all(window.event.srcElement.id + "p").style.display = ""; } else { document.all(window.event.srcElement.id + "p").style.display = "none"; } } } // --> </script> </head> <body onclick="checkBold()"> <h1 id="head1">Heading One</h1> <p id="head1p" style="display:none">111111111111111</p> <h1 id="head2">Heading Two</h1> <p id="head2p" style="display:none">22222222</p> <h1 id="head3">Heading Three</h1> <p id="head3p" style="display:none">3333</p> </body> </html>
|
|
|
HTML code for linking to this page:
|