Forum Moderators: open

Message Too Old, No Replies

Click to hide DIV

         

marcus1060

6:25 am on Oct 26, 2006 (gmt 0)

10+ Year Member



I need to make it so a user can click a image, or link, or submit button or something to remove a div, or two.

Thanks.

JAB Creations

11:34 pm on Oct 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This should be served as application/xhtml+xml unless of course you degrade to 1.0 Strict or lower as you can then serve it as text/html. Have fun Marcus!

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Test</title>
<script type="text/javascript">
//<![CDATA[
function change(id, newClass)
{
identity=document.getElementById(id);
identity.className=newClass;
}
//]]>
</script>
<style type="text/css">
div.hidden {
display: none;
}
div.promptshow {
background: #bbb;
display: block;
}
</style>
</head>
<body>
<div>
<a href="#" onclick="change('hiddendiv1', 'promptshow');">Display div 1</a>
<a href="#" onclick="change('hiddendiv2', 'hidden');">Hide div 2</a>

<div class="hidden" id="hiddendiv1">hide this div</div>
<div id="hiddendiv2">previously hiding div</div>

</div>
</body>
</html>

- John