473,763 Members | 8,980 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript and div's with style.display=n one 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.getEle mentById("optio n34");
myDiv.style.dis play='none';

2) all div's belonging to my desired part visible by:
var myDiv = document.getEle mentById("optio n35");
myDiv.style.dis play='block';
---------------

This works fine.
I even passed the validation at validator.w3c.o rg
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 8001
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
40762
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,...
18
7249
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 with document.myform.firstname
1
3712
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 {display: table-row;}
2
1234
by: dee | last post by:
Hi, How can you put 2 links in one line that use the style display:block? Thanks Dee
8
4247
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 visibility:hidden will do as well. <div> <p>Some content</p> <p><a href="#">Hide</a></p>
4
70092
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;
5
1829
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 options appear. When I used this attribute, would search engines ignore indexing the hidden submenu links because it doesnt initially appear on the screen. Im a bit concerned that my links wont be followed through during indexing (and theres many of...
2
1548
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 at a time..
5
2970
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 have a script tag, that document.write's some HTML. Like this:
0
9387
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10148
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...
1
9938
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9823
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...
1
7368
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
6643
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
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3528
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.