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

Discussion in 'ASP .Net' started by RA, Feb 19, 2004.

  1. RA

    RA Guest

    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
     
    RA, Feb 19, 2004
    #1
    1. Advertising

  2. RA

    Jon Guest

    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

    "RA" <> wrote in message
    news:...
    > 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
    >
    >
     
    Jon, Feb 19, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VijayRama
    Replies:
    2
    Views:
    2,395
    Gregory A. Beamer
    Oct 12, 2009
  2. JDP@Work

    Show Hide Table(s), Rows & Cells w/out a postback

    JDP@Work, Apr 20, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    216
    JDP@Work
    Apr 20, 2006
  3. Harry

    Dynamically Show/Hide table rows?

    Harry, Sep 3, 2003, in forum: Javascript
    Replies:
    3
    Views:
    415
    Vjekoslav Begovic
    Sep 3, 2003
  4. Wang, Jay
    Replies:
    9
    Views:
    251
  5. Replies:
    4
    Views:
    151
Loading...

Share This Page