How to hide table rows and show them when user click a different row?

R

RA

Hi

I want to have a FAQ so that when the user clicks the question the answer
will be shown below the questions. How do I do it? I use c# with asp.net.

Thanks
 
J

Jon

Hi,
that's probably a client side thing. Something like
<script type="text/javascript">
function showFaq(id){
if(!document.getElementById){return;}
else{
s=document.getElementById('answer'+id);
s.style.display='block';}}

function hideAllFaqs(){
if(document.getElementById && !window.opera){
document.write('<style>#questions div{display:none;}</style>')}
}
</script>
<body onload="hideAllFaqs();">
<div id="questions">
<p><a onclick="showFaq('1'); return false;" href="javascript:;">Why Is
That?</a></p>
<div id="answer1">Just Because</div>
<p><a onclick="showFaq('2'); return false;"
href="javascript:;">When?</a></p>
<div id="answer2">Sometime</div>
etc

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top