how to do this, show hide example?

Discussion in 'HTML' started by soni2926@yahoo.com, Apr 7, 2007.

  1. Guest

    , Apr 7, 2007
    #1
    1. Advertising

  2. On Apr 6, 7:00 pm, wrote:
    > Hi,
    > Can someone explain how to do the "Hide Example" "Show Example" thats
    > on this page:http://msdn.microsoft.com/library/default.asp?url=/workshop/author/pe...



    it is CSS style attribute display. Example-

    <body style="font:.8em arial">
    <script>
    function showHide(E){
    var Elm=document.getElementById(E)||{style:{}}
    Elm.style.display=Elm.style.display=='none'?'':'none'
    }
    </script>
    <b onclick="showHide('example')" style="text-
    decoration:underline">Show Example</b><br>
    <span id=example >
    some content ....
    </span>
    </body>
     
    scripts.contact, Apr 9, 2007
    #2
    1. Advertising

  3. Guest

    hi,
    if i try the below, using your example:
    <body style="font:.8em arial">
    <script>
    function showHide(E){
    var Elm=document.getElementById(E)||{style:{}}
    Elm.style.display=Elm.style.display=='none'?'':'none'


    }


    </script>
    <b onclick="showHide('example')" style="text-
    decoration:underline">Show Example</b><br>
    <span id=example >
    some content ....
    </span>
    <br>hello i'm below the span.....<br>
    so am i
    </body>

    it hides, but when it does it leaves a gap above "hello i'm below..."
    while that microsoft page, it didn't leave a gap when hidden. anyway
    to avoid that gap?
     
    , Apr 9, 2007
    #3
  4. On Apr 9, 7:33 am, wrote:
    > hi,
    > if i try the below, using your example:

    ....
    > it hides, but when it does it leaves a gap above "hello i'm below..."
    > while that microsoft page, it didn't leave a gap when hidden. anyway
    > to avoid that gap?


    yes.

    this is the html content-

    <b >Show Example</b>
    <br>
    <span>some content ....</span>
    <br>
    hello i'm below the span.....
    <br>
    so am i

    after hiding the span element :

    <b >Show Example</b>
    <br>
    <br>
    hello i'm below the span.....
    <br>
    so am i
    ----------

    as you can see, now there are 2 line breaks.
    To avoid this, put one <br> inside the span element :

    <b>Show Example</b><br>
    <span id=example >
    some content ....
    <br>
    </span>
    hello i'm below the span.....<br>
    so am i


    : )
     
    scripts.contact, Apr 9, 2007
    #4
    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. Jerad Rose

    Dynamically Show/Hide Groups of TR's

    Jerad Rose, Jun 24, 2003, in forum: ASP .Net
    Replies:
    12
    Views:
    11,615
    intrader
    Jul 10, 2005
  2. =?Utf-8?B?bWlrZWU=?=

    Cursor wait, hide or show

    =?Utf-8?B?bWlrZWU=?=, Dec 12, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    736
    Alex Papadimoulis
    Dec 12, 2003
  3. RA
    Replies:
    1
    Views:
    3,991
  4. Jeremy S

    Show/Hide controls at runtime

    Jeremy S, Mar 4, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    548
    Curt_C [MVP]
    Mar 4, 2004
  5. ll
    Replies:
    2
    Views:
    651
    Thomas 'PointedEars' Lahn
    May 1, 2008
Loading...

Share This Page