473,771 Members | 2,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with style.display=" none" in NN7

Hi,

I have a section of a web page that I want to be able to make appear and
disappear with javascript, with the things below it moving up and down as
appropriate. I'm not using absolute positioning or anthing fancy. I put the
aforementioned section in a div:

<div id="foo">
... optional stuff in here
</div>

when I want to hide it, I do this:

document.getEle mentById("foo") .style.display= "none";

and to show it again I do this:

document.getEle mentById("foo") .style.display= "inline";

This works fine in IE6 and Opera, but I have a problem with NN7. When the
page comes up it's visible. the first time I hide it, it works fine, then I
show it again and it works, the second time I try to hide it, nothing
happens - the display style gets set to 'none' but the div is still visible
on the page.

if the div contains only text (no tags at all), it works OK every time.

Can anybody throw any light on this or suggest possible workarounds?

Many thanks

Andy
Jul 20 '05 #1
8 10414
Andy Fish schrieb:
Hi,

I have a section of a web page that I want to be able to make appear and
disappear with javascript, with the things below it moving up and down as
appropriate. I'm not using absolute positioning or anthing fancy. I put the
aforementioned section in a div:

<div id="foo">
... optional stuff in here
</div>

when I want to hide it, I do this:

document.getEle mentById("foo") .style.display= "none";

and to show it again I do this:

document.getEle mentById("foo") .style.display= "inline";

This works fine in IE6 and Opera, but I have a problem with NN7. When the
page comes up it's visible. the first time I hide it, it works fine, then I
show it again and it works, the second time I try to hide it, nothing
happens - the display style gets set to 'none' but the div is still visible
on the page.

if the div contains only text (no tags at all), it works OK every time.

Can anybody throw any light on this or suggest possible workarounds?

Many thanks

Andy


Can you provide a link? That would help a lot.

Klaus

--
Registered Linux user #54760

Jul 20 '05 #2
Andy Fish schrieb:
Hi,

I have a section of a web page that I want to be able to make appear and
disappear with javascript, with the things below it moving up and down as
appropriate. I'm not using absolute positioning or anthing fancy. I put the
aforementioned section in a div:

<div id="foo">
... optional stuff in here
</div>

when I want to hide it, I do this:

document.getEle mentById("foo") .style.display= "none";

and to show it again I do this:

document.getEle mentById("foo") .style.display= "inline";

This works fine in IE6 and Opera, but I have a problem with NN7. When the
page comes up it's visible. the first time I hide it, it works fine, then I
show it again and it works, the second time I try to hide it, nothing
happens - the display style gets set to 'none' but the div is still visible
on the page.

if the div contains only text (no tags at all), it works OK every time.

Can anybody throw any light on this or suggest possible workarounds?

Many thanks

Andy


Can you provide a link? That would help a lot.

Klaus

--
Registered Linux user #54760

Jul 20 '05 #3
here's a complete stand-alone example:

<HTML><head><sc ript language="javas cript">
function Button1_onclick ()
{document.getEl ementById("foo" ).style.display ="none";}
function Button2_onclick ()
{document.getEl ementById("foo" ).style.display ="inline";}
</script></head>
<BODY>
<p>this is always visible</p>
<div id="foo"><p>thi s is sometimes visible</p></div>
<P>
<INPUT id="Button1" type="button" value="Button" name="Button1"
onclick="return Button1_onclick ()">
<INPUT id="Button2" type="button" value="Button" name="Button2"
onclick="return Button2_onclick ()">
</P>
</BODY>
</HTML>

click on the left button to make the text disappear and the right button to
make it appear. on Netscape 7 it only works once then it stays visible all
the time. other browsers seem to work OK.
"Klaus Krtschil" <kl*****@gmx.de > wrote in message
news:bh******** ****@ID-105021.news.uni-berlin.de...

Can you provide a link? That would help a lot.

Klaus

--
Registered Linux user #54760

Jul 20 '05 #4
Lee
Andy Fish said:

here's a complete stand-alone example:
[...]
click on the left button to make the text disappear and the right button to
make it appear. on Netscape 7 it only works once then it stays visible all
the time. other browsers seem to work OK.


It works fine for me in Netscape 7.1.
What messages do you see in the JavaScript console?

Jul 20 '05 #5
Makes sense since DIV is a block element whereas plain text is an inline
element.

Andy Fish wrote:
fixed it (I think)

using the darwinian theory of natural selection, I tried making random
changes to the code to see if it would make any difference

turns out that using style.display=" block" to make it visible (rather than
"inline" works OK).

Andy
"Andy Fish" <aj****@blueyon der.co.uk> wrote in message
news:y_******** *************@n ews-text.cableinet. net...
here's a complete stand-alone example:

<HTML><head>< script language="javas cript">
function Button1_onclick ()
{document.get ElementById("fo o").style.displ ay="none";}
function Button2_onclick ()
{document.get ElementById("fo o").style.displ ay="inline";}
</script></head>
<BODY>
<p>this is always visible</p>
<div id="foo"><p>thi s is sometimes visible</p></div>
<P>
<INPUT id="Button1" type="button" value="Button" name="Button1"
onclick="retu rn Button1_onclick ()">
<INPUT id="Button2" type="button" value="Button" name="Button2"
onclick="retu rn Button2_onclick ()">
</P>
</BODY>
</HTML>

click on the left button to make the text disappear and the right button


to
make it appear. on Netscape 7 it only works once then it stays visible all
the time. other browsers seem to work OK.
"Klaus Krtschil" <kl*****@gmx.de > wrote in message
news:bh****** ******@ID-105021.news.uni-berlin.de...

Can you provide a link? That would help a lot.

Klaus

--
Registered Linux user #54760




Jul 20 '05 #6
I have netscape 7.01 - nothing was coming out on the JS console

so maybe it was a bug and my fix was infact a workaround.

"Lee" <RE************ **@cox.net> wrote in message
news:bh******** @drn.newsguy.co m...
Andy Fish said:

here's a complete stand-alone example:
[...]
click on the left button to make the text disappear and the right button tomake it appear. on Netscape 7 it only works once then it stays visible allthe time. other browsers seem to work OK.


It works fine for me in Netscape 7.1.
What messages do you see in the JavaScript console?

Jul 20 '05 #7
Andy Fish schrieb:
fixed it (I think)

using the darwinian theory of natural selection, I tried making random
changes to the code to see if it would make any difference

turns out that using style.display=" block" to make it visible (rather than
"inline" works OK).

Andy
"Andy Fish" <aj****@blueyon der.co.uk> wrote in message
news:y_******** *************@n ews-text.cableinet. net...
here's a complete stand-alone example:

<HTML><head>< script language="javas cript">
function Button1_onclick ()
{document.get ElementById("fo o").style.displ ay="none";}
function Button2_onclick ()
{document.get ElementById("fo o").style.displ ay="inline";}
</script></head>
<BODY>
<p>this is always visible</p>
<div id="foo"><p>thi s is sometimes visible</p></div>
<P>
<INPUT id="Button1" type="button" value="Button" name="Button1"
onclick="retu rn Button1_onclick ()">
<INPUT id="Button2" type="button" value="Button" name="Button2"
onclick="retu rn Button2_onclick ()">
</P>
</BODY>
</HTML>

click on the left button to make the text disappear and the right button


to
make it appear. on Netscape 7 it only works once then it stays visible all
the time. other browsers seem to work OK.
"Klaus Krtschil" <kl*****@gmx.de > wrote in message
news:bh****** ******@ID-105021.news.uni-berlin.de...

Can you provide a link? That would help a lot.

Klaus

--
Registered Linux user #54760



Both variants (block/inline) work with Moz 1.4 (Linux)

Klaus

--
Registered Linux user #54760

Jul 20 '05 #8
Andy Fish wrote:
turns out that using style.display=" block" to make it visible (rather than
"inline" works OK).


http://bugzilla.mozilla.org/show_bug.cgi?id=195567

[yikes! this thread is cross-posted all over the show. Follow-ups set
to n.p.m.browser]

--
gav
http://www.livejournal.com/users/blufive/

Jul 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
40764
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div style="display:none"> can be displayed by setting the style attribute to "display:", or hidden with "display:none". This gives the illusion that the person filling out the form is switching from page to page...without the overhead of extra hits on the server,...
52
4204
by: Markus Elfring | last post by:
How much are you interested that the attribute "style" will offer the same or similar capabilities like they are provided by the element "style" in the element "head"? Do you want that the document "Syntax of CSS rules in HTML's "style" attribute" (http://www.w3.org/TR/css-style-attr) will become an official recommendation in the near future? Best regards, Markus Elfring
5
9825
by: Sue | last post by:
Help! I have an asp table with an embedded table. The asp tablerow that contains this table has a static ID assigned of "FilterRow2" (see snippets of code below). When I click on the button to set the tablerow style property to "None", the row (And embedded table) briefly disappear, but then bounce right back into sight. Any ideas on why it's doing this and how to make the style.display = "None" stick?
3
4491
by: Stan Brown | last post by:
Posted by Pierre Blais in the current RISKS Digest: http://catless.ncl.ac.uk/Risks/24.24.html#subj9 -- Stan Brown, Oak Road Systems, Tompkins County, New York, USA http://OakRoadSystems.com/ HTML 4.01 spec: http://www.w3.org/TR/html401/ validator: http://validator.w3.org/ CSS 2.1 spec: http://www.w3.org/TR/CSS21/ validator: http://jigsaw.w3.org/css-validator/
2
9611
by: Good Man | last post by:
Hi there I have quite a bit of experience with CSS but I am stumped by the following: http://www.electricphase.com/example/example1.php (uses http://www.electricphase.com/example/test1.css) http://www.electricphase.com/example/example2.php (uses http://www.electricphase.com/example/test2.css)
5
1502
by: sunny | last post by:
int a=10; switch(a) { case '1': printf("ONE\n"); break; case '2': printf("TWO\n"); break; defa1ut:
6
29289
chunk1978
by: chunk1978 | last post by:
hi there... i'm about to embark on my very first PHP code journey (i've been saying that for a while... so sometime soon i hope... anyway)... before i begin my exciting new journey into PHP land, i would like to know if PHP will send hidden HTML form elements or not?... for example: if a user makes a selection in my HTML form that triggers my wonderfully dynamic HTML to set a DIV to STYLE="DISPLAY:NONE", is it possible to tell PHP not...
4
70093
by: gimme_this_gimme_that | last post by:
Hi, I have an onchange method for a select box that goes something like this (the select is in a form named aForm): function page_on_change() { pageElement = aForm.my_page_id; aForm.nav_page_name.value = pages.value]; var si = pageElement.selectedIndex;
0
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.