| jmrker |
08-28-2011 12:56 AM |
Slight modification from last post to include a bit more JS and some CSS.
Only advantage is that click on question box shows/hides the answer
and the box makes it easier to know where to put cursor for mouse click.
Code:
<!DOCTYPE HTML>
<html>
<head>
<title> FAQ Display </title>
<style type="text/css">
.FAQ { cursor:hand; cursor:pointer;
border:1px solid red; width:50%; }
.FAA { display:none; }
</style>
<script type="text/javascript">
function toggle(Info) {
var CState = document.getElementById(Info);
CState.style.display = (CState.style.display != 'block')
? 'block' : 'none';
}
</script>
</head>
<body>
<h2>FAQ section</h2>
<DIV class="FAQ" onclick="toggle('faq1')">
whassup?
<div id="faq1" class="FAA">nadda</div>
</DIV>
<DIV class="FAQ" onclick="toggle('faq2')">
whassup now?
<div id="faq2" class="FAA">still nadda</div>
</DIV>
<DIV class="FAQ" onclick="toggle('faq3')">
How about now?
<div id="faq3" class="FAA">How many times must I say <b>nothing</b>?</div>
</DIV>
</body>
</html>
|