473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Javascript and div's with style.display=none or block bugging in IE 5.5 and 6.0

Hi group,

I have this obscure problem that really needs to be fixed, but I am out of
ideas.
Because the original script is very big, I'll try to summarize its
functionality.

Setup:
- many form-elements that will 'activate' a part of the form based on the
selection made.
eg: A SELECT that will display a different part of the form depending on the
selection made.

- I implemented this by creating div's with an unique id.
They are standard off, as in:
<div id="option34" style="display:none">
Your name: <input type="text" name="firstname">
<br>
Your age: <input type="text" name="age">
</div>

<div id="option35" style="display:none">
Question bla: <input type="text" name="q33">
<br>
Question blabla: <input type="text" name="q56">
</div>

etc.
- The change in the selection in the SELECT will fire a JS function that
will make:
1) all div's that belong to other selections invisible by stetting their
var myDiv = document.getElementById("option34");
myDiv.style.display='none';

2) all div's belonging to my desired part visible by:
var myDiv = document.getElementById("option35");
myDiv.style.display='block';
---------------

This works fine.
I even passed the validation at validator.w3c.org
My doctype is 'loose.dtd' (please don't make me type the whole thingy.)

My problem:
Sometimes IE5.5 and 6.0 don't do it right.
I do not get a JS-error or something, but after I made some div's invisible
and others visible, IE leave 'grey area's' behind.
Sometimes IE leaves pieces of the old form (now display='none') behind, and
it looks like it is indeed just a piece of the old screen because I cannot
'use' the elements, like using a formelement type="text".

(This never happens in Firefox.)

Does anybody know how I solve this?
Is IE buggy somehow with div's that are made visible and invisible?
Can I tell IE to render right somehow?
Is my approach wrong?

Thanks for your time.

Regards,
Erwin Moller
Feb 17 '06 #1
2 7979
Erwin Moller wrote:
I have this obscure problem that really needs to be
fixed, but I am out of ideas.
Because the original script is very big, I'll try to
summarize its functionality.
It is rarely effective to attempt to solve browser-scripting problems
with a summary of what a script does. It is particularly ineffective if
the problem as described is not common, or cannot be attributed to a
single cause.

What is needed is a test case page that demonstrates the problem in
isolation. With such a page as a starting point experiments and tests
can be carried out by readers of the group and that process may (and
usually does) identify the cause of the issue. And when a test case
demonstrates a problem in isolation the result is usually short enough
to be posted to the group (and possibly also made available online for
those who prefer code presented in that form (or for test cases
involving images and/or frames, which don't lend themselves to posted
pure code)).

<snip> ... , IE leave 'grey area's' behind.
Sometimes IE leaves pieces of the old form
(now display='none') behind, ...
I have seen those symptoms attributed to faulty display drivers and/or
corrupted windows libraries, either of which can be tested/eliminated by
trying the offending page on alternative hardware on a different
machine.

<snip> Does anybody know how I solve this?
You have not demonstrated that the problem exists, only described it.
Is IE buggy somehow with div's that are made visible
and invisible?
Generally no, IE is fine with making DIVs visible/invisible and
displayed/not displayed.
Can I tell IE to render right somehow?
Probably, else IE would be pretty hopeless at DHTML.
Is my approach wrong?

<snip>

Yes, you need to create a test case page that demonstrates the problem.
A good starting point for that process is the page you already have that
exhibits the problem. If you eliminate parts of that page; unrelated
mark-up and css, as many of the form's DIVs as are not required to
produce the problem, all unrelated javascript, etc. you should end up
with something short and simple enough to post. And an interesting
consequence of trying to crate a good test case page is that if you
re-load and re-test the page while incrementally removing the apparently
superfluous you often discover that when you remove something you had
assumed to be unrelated to the issue the problem vanishes. At which
point you have learnt something useful about the problem at hand. This
is actually so effective that in probably more than 50% of cases the act
of creating a test case page will reveal the problem in itself, without
the need to refer the result on to others.

Richard.
Feb 18 '06 #2
Richard Cornford wrote:

<snip>

Thanks Richard.

I completely agree with you: Show the code.

This was in my situation just impossible because of a deadline.
The offending page was over 500K, and contained over 6000 lines of html and
javascript. I didn't want to throw such a monster in your/anybody's hands.

Cleaning the code to isolate the problem was just impossible for me at that
time (timewise).
This, of course, is/was my problem.

I hoped my description of the behaviour would ring some bells in this
community because they heard the story hundred times before and knew what I
did (probably) wrong.

However, the problem is solved by now.
After I made sure my code was W3C-compliant (DTD Loose/transitional), and
the problem still persisted, I started looking at other things.

It turned out the stylesheet I received contained some relatively placed
tables. Removing the relative-part made the problem disappear, while not
breaking the lay-out.
Don't ask me why: I do not know too much of stylesheets.

I just write it here so maybe it can help some googling soul someday tracing
a similar problem.

Thanks for your time.

Regards,
Erwin Moller

Feb 21 '06 #3

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

Similar topics

13
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...
18
by: Michal Mieszkowski | last post by:
i have a block of html code looking like this <FORM name=myform> <INPUT type=text name=firstname> <DIV id=mydiv> <INPUT type=text name=address> </DIV> </FORM> i can access firstname field...
1
by: Laurel | last post by:
Hi, Do you know some browsers that would misbehave with these three lines of CSS code: table.liste tr {display:none;} table.liste tr.headers {display: block;} table.liste tr.headers...
2
by: dee | last post by:
Hi, How can you put 2 links in one line that use the style display:block? Thanks Dee
8
by: VK | last post by:
Hi, given a block element with some content and a link, is it possible to set this element display to none by CSS only? It has to be done only once. It is an absolutely positionned element so...
4
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;...
5
by: bissatch | last post by:
Hi, I ocasionally use display: none; to hide divs that, on the click of a link they will reappear. For example, maybe I create a menu and when you click a link of menu options the submenu...
2
hsriat
by: hsriat | last post by:
Maximum how many elements can be made hidden by giving STYLE={DISPLAY:NONE} in a single HTML file. Any restriction?... If it is there.. any way out as I want to make 110 rows with DISPLAY:NONE...
5
by: SuneR | last post by:
Hi, I am having problems figuring out how to make Firefox behave, and output the HTML I want it to output. The thing I want done is actually quite simple. I have a <labeltag, and inside it, I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.