473,499 Members | 1,576 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

style.display cross browser problem

Take a look at this page. http://tempsite.texwipe.com/test/ The code
is too long to post here so just look at the source.

It works flawlessly in IE, but in Firefox not so much. Here is the
situation. I am using the javascript property style.display to show
and hide some div layers. These layer ids are Layer1, Layer2, Layer3,
etc. Each link on the left controls what is shown or hidden. When they
are clicked, the corresponding layer is displayerd. "All products"
displays all available layers.

As I said this is not a problem in IE but in Firefox almost
consistently I have 2 problems. Do the following to reproduce them.
Overlapping text:
1. Click any of the menu items on the right (except All products). The
layer will be displayed.
2. Without refreshing the page, click the All Products. All of the
layers are displayed but they overlap the footer.

All of layer not hidden:
1. Refresh the page.
2. Click All Products. This will not overlap the footer as above.
3. Click any other menu item. The layer is not shrunk back to its
original size.
4. Click a few more menu items (except All products) and the layer will
eventually shrink back to the correct size.

Now as I said this works in IE. Please help me figure out the Firefox
issue.

Thank you!
Brian

Sep 27 '06 #1
1 1816

Brian D wrote:
Take a look at this page. http://tempsite.texwipe.com/test/ The code
is too long to post here so just look at the source.

It works flawlessly in IE, but in Firefox not so much. Here is the
situation. I am using the javascript property style.display to show
and hide some div layers. These layer ids are Layer1, Layer2, Layer3,
etc. Each link on the left controls what is shown or hidden. When they
are clicked, the corresponding layer is displayerd. "All products"
displays all available layers.
[...]
Now as I said this works in IE. Please help me figure out the Firefox
issue.
There just seems to be way too much code. Try the example below:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<title>Play</title>

<style type="text/css">
body {
font-family: monaco, arial, sans-serif;
font-size: 80%;
}

#menu {
width: 10em;
float: left;
padding-bottom: 10px;
}

#content {
border-left: 1px solid #bbb;
margin-left: 10em;
}

#content div {
border-bottom: 1px solid #bbb;
margin-left: 10px;
}
..banner {
border-bottom: 1px solid #bbb;
text-align: center;
}

</style>

<script type="text/javascript">

function toggleVis(id){
var content = document.getElementById('content');
var x = content.firstChild;
var displayValue = ( '*' == id)? '' : 'none';

while(x){
if (x.style) x.style.display = displayValue;
x = x.nextSibling;
}
if ('none' == displayValue){
if ('object' == typeof id){
id = id.href.replace(/^[^#]*#/,'');
}
document.getElementById(id).style.display = '';
}
return false;
}

</script>
<body>

<div class="banner">header stuff</div>
<div id="menu">
<a href="#product_1" onclick="return toggleVis(this);">product 1</a>
<br>
<a href="#product_2" onclick="return toggleVis(this);">product 2</a>
<br>
<a href="#product_3" onclick="return toggleVis(this);">product 3</a>
<br>
<a href="#product_4" onclick="return toggleVis(this);">product 4</a>
<br>
<a href="#product_5" onclick="return toggleVis(this);">product 5</a>
<br>
<a href="#" onclick="toggleVis('*');">Show all</a>
</div>

<div id="content">
<div id="product_1">
<p><b>Product 1</b></p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Suspendisse vel sem non est suscipit ultricies. Sed pretium accumsan
est. Proin nisi augue, vehicula a, pharetra faucibus, sollicitudin non,
urna. Vivamus ac mauris. Phasellus convallis sollicitudin ipsum. Mauris
ut tortor. Vivamus enim ipsum, sollicitudin nec, tristique quis,
laoreet non, odio. Nulla facilisi. Nulla quis nisi. Nullam pretium
mattis risus. Etiam leo lacus, rhoncus vitae, varius eget, interdum
eget, sapien. Vestibulum vel tellus. Morbi suscipit tortor congue
nulla. Aliquam felis lorem, placerat ac, blandit a, egestas a, odio.
Donec sed magna non massa congue adipiscing.</p>
</div>

<div id="product_2">
<p><b>Product 2</b></p>
<p>Duis at nisl a ligula laoreet luctus. Aliquam scelerisque
iaculis massa. Sed cursus dignissim tortor. Phasellus sapien massa,
nonummy ut, mollis mattis, pretium vel, leo. Morbi purus massa, laoreet
ac, condimentum id, sollicitudin feugiat, sapien. Donec sit amet lacus
non mauris blandit posuere. Nulla facilisi. Vivamus a tellus eget velit
eleifend tincidunt. Vivamus nibh nulla, vehicula eu, tempus at,
vestibulum ut, magna. Mauris suscipit molestie orci. Aliquam erat
volutpat.</p>
</div>

<div id="product_3">
<p><b>Product 3</b></p>
<p>Nullam nec lacus non tortor rutrum malesuada. Sed dignissim. Sed
sit amet diam non lorem feugiat pharetra. Mauris nec turpis. Phasellus
feugiat. Praesent diam. Nunc tempor rhoncus tortor. Nulla egestas arcu.
Mauris eros tellus, porttitor eu, malesuada a, condimentum in, enim.
Quisque non pede sed nibh scelerisque rutrum. Nullam scelerisque arcu
quis tortor. Aliquam auctor, leo a vestibulum commodo, enim nunc
sollicitudin purus, vitae blandit nisi metus id orci. Phasellus ut
nulla. Aenean elementum, ante sed placerat tempor, nulla leo ultricies
lectus, in ultricies eros odio et ipsum. Praesent eu lectus.
Pellentesque augue nibh, luctus id, congue ut, posuere ac, urna. Donec
justo.</p>
</div>

<div id="product_4">
<p><b>Product 4</b></p>
<p>Suspendisse quis justo vel neque convallis commodo. Aliquam
faucibus nulla eget libero. In pede tortor, iaculis id, commodo vitae,
pellentesque et, ligula. Proin et erat ac magna eleifend hendrerit. Ut
id augue sed eros egestas tincidunt. Quisque consectetuer tellus. Proin
semper tincidunt lectus. Pellentesque nisi. Praesent quis mauris et sem
pretium dignissim. Vestibulum vitae lacus ut est aliquam facilisis. Sed
non sapien.</p>
</div>

<div id="product_5">
<p><b>Product 5</b></p>
<p>Aliquam erat volutpat. Vestibulum vehicula eros sed nibh. Ut
elementum nonummy arcu. Curabitur vehicula justo sed nisi. Nam commodo
felis eget mi. Etiam venenatis mollis nisl. Donec dui est, eleifend ut,
luctus sed, imperdiet semper, eros. Nulla id arcu. Nulla facilisi.
Praesent et enim eget neque suscipit dignissim. Nulla quis justo
suscipit tortor lacinia ultricies. In et ligula. Aliquam varius odio
quis lectus. Maecenas in odio. In ac sapien. Ut dapibus.</p>
</div>
</div>
<script type="text/javascript">
toggleVis('product_1');
</script>
<div class="banner">Footer stuff</div>
</body>

--
Rob

Sep 28 '06 #2

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

Similar topics

13
40620
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...
8
10384
by: Andy Fish | last post by:
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...
4
5434
by: lawrence | last post by:
Can anyone tell me why this code works in Netscape 7.1 but not in IE??? <SCRIPT type='text/javascript'> function makeVisible(nameOfDiv) {...
9
2161
by: JimO | last post by:
I'm a newbie at this and I can't seem to find a list properties names to change styles on the fly. So far I've been lucky and managed to guess the names such as BodyElement.style.marginTop = 0;...
10
1815
by: Joost Jacob | last post by:
On URL http://homepages.cwi.nl/~jacob/bridgehand_try_1.html you can see a bridgehand in HTML + CSS-style attributes. It does not use images or tables and I would like to keep it that way. As...
49
3221
by: SamFeltus | last post by:
I am trying to figure out why so little web development in Python uses Flash as a display technology. It seems most Python applications choose HTML/CSS/JS as the display technology, yet Flash is a...
1
9011
by: RonY | last post by:
I have a dropdown which calls SetTimePeriod method on change the selection. In the JS function, I reset the field style.display based on what the selection is. This works fine with IE but not working...
35
2384
by: nobody | last post by:
I need to pop up a modal JS-based dialog (for some reason can't use popup window, much less so showModalDialog()), and I'd like to imitate the system popup titlebar according to user's desktop...
0
7009
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
7178
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,...
1
6899
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
5475
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,...
1
4919
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...
0
4602
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...
0
3103
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...
0
3094
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
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 ...

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.