Show and Hide spans in IE & Netscape


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Show and Hide spans in IE & Netscape

  1. #1
    Wesley Long Guest

    Show and Hide spans in IE & Netscape

    I have been able to do some very nice effects in IE using the
    span.style.display="none" and span.style.display="" javascript steps to show
    and hide blocks of text with mouseclicks.

    However, when I view them in Netscape, I notice that the scripts seem to
    abort when they reach this step.

    Does any one know what the equivalent method in Netscape might be? Better
    yet, is there a cross-browser method that would work better?

    I apologize if this has been discussed before, but I can't find anything in
    this newsgroups current collection that applies to Netscape (other than a
    reference to it being difficult to do).

    I appreciate any insight you might have to share.



  2. #2
    shobha Guest

    Re: Show and Hide spans in IE & Netscape


    hi,

    why dont you use span.style.visibility = "visible" to show or span.style.visibility
    = "hidden" to hide...
    this would work in both the browsers.




    "Wesley Long" <wesl@burstvideo.com> wrote:
    >I have been able to do some very nice effects in IE using the
    >span.style.display="none" and span.style.display="" javascript steps to

    show
    >and hide blocks of text with mouseclicks.
    >
    >However, when I view them in Netscape, I notice that the scripts seem to
    >abort when they reach this step.
    >
    >Does any one know what the equivalent method in Netscape might be? Better
    >yet, is there a cross-browser method that would work better?
    >
    >I apologize if this has been discussed before, but I can't find anything

    in
    >this newsgroups current collection that applies to Netscape (other than

    a
    >reference to it being difficult to do).
    >
    >I appreciate any insight you might have to share.
    >
    >



  3. #3
    Wesley Long Guest

    Re: Show and Hide spans in IE & Netscape

    Unfortunately, setting style.visibility="hidden" will still keep the
    vertical space occupied by the span, where style.display="none" will
    "collapse" the area of the text where the span is, allowing information
    below it (other spans that I'm showing) to slide up into its place, rather
    than being positioned below a bunch of blank space.

    "shobha" <shobhaiyer@yahoo.com> wrote in message
    news:3addc2b4$1@news.devx.com...
    >
    > hi,
    >
    > why dont you use span.style.visibility = "visible" to show or

    span.style.visibility
    > = "hidden" to hide...
    > this would work in both the browsers.
    >
    >
    >
    >
    > "Wesley Long" <wesl@burstvideo.com> wrote:
    > >I have been able to do some very nice effects in IE using the
    > >span.style.display="none" and span.style.display="" javascript steps to

    > show
    > >and hide blocks of text with mouseclicks.
    > >
    > >However, when I view them in Netscape, I notice that the scripts seem to
    > >abort when they reach this step.
    > >
    > >Does any one know what the equivalent method in Netscape might be?

    Better
    > >yet, is there a cross-browser method that would work better?
    > >
    > >I apologize if this has been discussed before, but I can't find anything

    > in
    > >this newsgroups current collection that applies to Netscape (other than

    > a
    > >reference to it being difficult to do).
    > >
    > >I appreciate any insight you might have to share.
    > >
    > >

    >




  4. #4
    Nick Guest

    Re: Show and Hide spans in IE & Netscape


    Hi,
    Unfortunately you are going to have a hard time doing what you are trying
    to do with NN4! NN4 does not have a scriptable property to correspond to
    the display style attribute, so you cannot modify this attribute on the fly(although
    NN does recognize the display attribute when a page loads).

    It will probably work equally in NN6 and IE but you are better off trying
    to make the 'visibility' property work as another user suggested.


    "Wesley Long" <wesl@burstvideo.com> wrote:
    >I have been able to do some very nice effects in IE using the
    >span.style.display="none" and span.style.display="" javascript steps to

    show
    >and hide blocks of text with mouseclicks.
    >
    >However, when I view them in Netscape, I notice that the scripts seem to
    >abort when they reach this step.
    >
    >Does any one know what the equivalent method in Netscape might be? Better
    >yet, is there a cross-browser method that would work better?
    >
    >I apologize if this has been discussed before, but I can't find anything

    in
    >this newsgroups current collection that applies to Netscape (other than

    a
    >reference to it being difficult to do).
    >
    >I appreciate any insight you might have to share.
    >
    >



  5. #5
    Wesley Long Guest

    Re: Show and Hide spans in IE & Netscape

    Yeah, I found that.

    However, the visibility property still gives me a problem in that the
    span/div may be invisible, but it still occupies space, and forces all the
    elements beneath it further down vertically. That just isn't an option for
    what I need to do.

    I figure my best bet is now to trap the user's browser type and version and
    take them to a different page for NN4.

    "Nick" <webmaster@mixsite.com> wrote in message
    news:3ae04b2e$1@news.devx.com...
    >
    > Hi,
    > Unfortunately you are going to have a hard time doing what you are trying
    > to do with NN4! NN4 does not have a scriptable property to correspond to
    > the display style attribute, so you cannot modify this attribute on the

    fly(although
    > NN does recognize the display attribute when a page loads).
    >
    > It will probably work equally in NN6 and IE but you are better off trying
    > to make the 'visibility' property work as another user suggested.
    >
    >
    > "Wesley Long" <wesl@burstvideo.com> wrote:
    > >I have been able to do some very nice effects in IE using the
    > >span.style.display="none" and span.style.display="" javascript steps to

    > show
    > >and hide blocks of text with mouseclicks.
    > >
    > >However, when I view them in Netscape, I notice that the scripts seem to
    > >abort when they reach this step.
    > >
    > >Does any one know what the equivalent method in Netscape might be?

    Better
    > >yet, is there a cross-browser method that would work better?
    > >
    > >I apologize if this has been discussed before, but I can't find anything

    > in
    > >this newsgroups current collection that applies to Netscape (other than

    > a
    > >reference to it being difficult to do).
    > >
    > >I appreciate any insight you might have to share.
    > >
    > >

    >




  6. #6
    Neko Tel'ra Guest

    Re: Show and Hide spans in IE & Netscape


    "Wesley Long" <wesl@burstvideo.com> wrote:
    >I have been able to do some very nice effects in IE using the
    >span.style.display="none" and span.style.display="" javascript steps to

    show
    >and hide blocks of text with mouseclicks.
    >
    >However, when I view them in Netscape, I notice that the scripts seem to
    >abort when they reach this step.
    >
    >Does any one know what the equivalent method in Netscape might be? Better
    >yet, is there a cross-browser method that would work better?
    >
    >I apologize if this has been discussed before, but I can't find anything

    in
    >this newsgroups current collection that applies to Netscape (other than

    a
    >reference to it being difficult to do).
    >
    >I appreciate any insight you might have to share.
    >
    >


    span.style.display is an IE specific feature, span.style.visiblity however
    is cross-browser.. and instead of using none and "" use visible and hidden
    both of which work cross-browser and produce the correct effects. Hope this
    helps.

    Neko Tel'ra


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center