473,714 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Collapsing Table Rows with DHTML in Netscape 7.2

I'm trying to create an effect wherein an HTML page contains a large
number of products (up to 125 possibly). Initially, only the first 3
are displayed. When the user clicks on a 'next' or 'previous' button,
the currently displayed products dissappear and the next or previous
set of 3 appear in the same place.
I've got it working in IE 6.0. It's mostly working in Netscape 7.2.
The only
problem in NS 7.2 is that each time you click on the 'previous' or
'next' buttons there is an area of space between the products and the
next/previous link that keeps on getting bigger untill you can't see
the products and the links on the same page.

The javascript code I'm using to hide things is :
function setObjectVisibi lity(objectID,s tate)
{
styleObject = dom(objectID,1) ;
styleObject.dis play = state;
}

I have a table with a series of rows with ID = "#" where # is the
zeroe-based sequence number of the row.
<tr id = "0"> ...</tr>
<tr id = "1">...</tr>
etc..

The page is located at
http://www.storesonline.com/site/615834/page/448822
The javascript is mostly in an external file at
http://www.storesonline.com/members/...loaded/menu.js
how do I make this work in current versions of Netscape?

Jul 23 '05 #1
4 2970


Monte Gardner wrote:

When the user clicks on a 'next' or 'previous' button,
the currently displayed products dissappear and the next or previous
set of 3 appear in the same place.
I've got it working in IE 6.0. It's mostly working in Netscape 7.2.
The only
problem in NS 7.2 is that each time you click on the 'previous' or
'next' buttons there is an area of space between the products and the
next/previous link that keeps on getting bigger untill you can't see
the products and the links on the same page.

The javascript code I'm using to hide things is :
function setObjectVisibi lity(objectID,s tate)
{
styleObject = dom(objectID,1) ;
styleObject.dis play = state;


If you want to have a <tr> element displayed then the correct CSS 2
display value is table-row and not block. Netscape/Mozilla implement CSS
2 and the problem you see is probably caused by your script setting the
display value of a <tr> element to block.
It is a bit difficult to write script for both IE and other browsers, in
particular as you seem to start with display: none set in static CSS.
It is easier to start no static CSS on the <tr> elements and then use
script to set
element.style.d isplay = 'none'
to hide an element and
element.style.d isplay = '';
to show it again.
Of course that means you need to hide some rows initially on page load
but that way your page does also work if script is disabled or not
supported so I suggest you go this way.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

"Monte Gardner" <Mo***********@ asu.edu> wrote in message
news:11******** *************@c 13g2000cwb.goog legroups.com...
I'm trying to create an effect wherein an HTML page contains a large
number of products (up to 125 possibly). Initially, only the first 3
are displayed. When the user clicks on a 'next' or 'previous' button,
the currently displayed products dissappear and the next or previous
set of 3 appear in the same place.
I've got it working in IE 6.0. It's mostly working in Netscape 7.2.
The only
problem in NS 7.2 is that each time you click on the 'previous' or
'next' buttons there is an area of space between the products and the
next/previous link that keeps on getting bigger untill you can't see
the products and the links on the same page.


The usual reason for displaying only a few items at a time is so that only a
few items need to be *sent* at one time, saving waiting time and network
bandwidth. You're not doing that--you're sending all of the items at once,
making the user wait for ALL the items to download to his page--and then you
only let him see three at a time anyway, and you make him wait for
Javascript to execute before showing him more. If you've already sent the
data anyway, then *display* it all, and let the user use his scroll bar to
browse through them.

Besides, when I look at your page in Firefox, it *does* show me all the
items; it only starts hiding them *after* I click Next.

Jul 23 '05 #3
ok, the style.display = ''; seems to have fixed the problem, though I'm
still
a little confused as to what was happening.
I left the static iniital CSS stuff in and it doesn't seem to be
causing a problem. My page works in current versions of IE, Netscape
and Mozilla Firefox now. Thanks for the help folks.

Martin Honnen wrote:
Monte Gardner wrote:

When the user clicks on a 'next' or 'previous' button,
the currently displayed products dissappear and the next or previous set of 3 appear in the same place.
I've got it working in IE 6.0. It's mostly working in Netscape 7.2. The only
problem in NS 7.2 is that each time you click on the 'previous' or
'next' buttons there is an area of space between the products and the next/previous link that keeps on getting bigger untill you can't see the products and the links on the same page.

The javascript code I'm using to hide things is :
function setObjectVisibi lity(objectID,s tate)
{
styleObject = dom(objectID,1) ;
styleObject.dis play = state;
If you want to have a <tr> element displayed then the correct CSS 2
display value is table-row and not block. Netscape/Mozilla implement

CSS 2 and the problem you see is probably caused by your script setting the display value of a <tr> element to block.
It is a bit difficult to write script for both IE and other browsers, in particular as you seem to start with display: none set in static CSS.
It is easier to start no static CSS on the <tr> elements and then use script to set
element.style.d isplay = 'none'
to hide an element and
element.style.d isplay = '';
to show it again.
Of course that means you need to hide some rows initially on page load but that way your page does also work if script is disabled or not
supported so I suggest you go this way.

--

Martin Honnen
http://JavaScript.FAQTs.com/


Jul 23 '05 #4
My understanding is that if you set the style of a table row to
"display:no ne"
as that table row is being written out, then any images within that row
will not
be loaded untill the table row is set back to visible again. That's
what I'm doing.
Is my understanding incorrect?

Jul 23 '05 #5

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

Similar topics

6
1998
by: viator | last post by:
Hello everybody. I am a student doing my masters in Comp. Sci. Will some explain to me why it seems completely two worlds when taking about DHTML in NN and IE. Is there any way to write truly portable webpages using DHTML ofcourse.
3
1928
by: Chris Leonard | last post by:
Hi. I've copied some code from a book which will enable me to make a layer around a page, my aim is to do something a little more complex but this I thought would get me started. Anyway, I've run into a problem before I even start! The script works OK, it runs the image in from the left hand side quite nicely, great. Problem I have it always scrolls up to the top of the page, when the link I click maybe 2 or 3 screens below (does that...
3
27142
by: Harry | last post by:
I want to provide a drill down facility for the users - the plan is to intially display a table with summary rows containing results of previous selected search criteria. In each summary row you have a button to drill down i.e which displays X number of rows with results that make up the summary row value. When "drilled down" also provide a button to "collapse" the detail rows! Is it possible to show/hide individual rows in a table? -...
5
8224
by: Harry Gould | last post by:
To all, I'm a newbie here, so please bear with me. I develop web pages for a company intranet where Internet Explorer 6 is the standard. Now I must develop a public internet website that is browser-agnostic (i.e., works with Netscape, version 4x, 7x, etc). My question is this: I have about 10 table rows, each tagged with a class attribute (<tr class="billing" style="display:none">) that I wish to make visible or invisible in response...
13
4161
by: kaeli | last post by:
Can anyone explain this to me? It's driving me insane. Save this and run it in IE or Opera and then in Mozilla or Netscape 6+. In IE/Opera, I get the expected 4 alerts. In Mozilla/Netscape, I get *9*. In the example table, there are 4 rows with 4 columns each in the tbody. I'd expect 4 child nodes for the table body with 4 children each. I get those 4 plus 5 alerts in Mozilla/Netscape. I get only those 4 in IE and Opera. Note that...
4
1621
by: Jeremy Epstein | last post by:
Hi guys, I've got a page that shows a number of packages available for sale. Each package has a little description, and then a (sometimes long) list of features for each package. I thought it would be a good idea to let visitors hide the details for each package, so that they can see just the summaries together. So I borrowed some code (can't remember from where), which was designed for expandable/collapsible menu trees, and used it to...
4
5095
by: Rob Freundlich | last post by:
I have some servlet-generated tabular data that I need to present, so I'm using an HTML Table. In some cases, it can be quite large. I'm flushing the servlet output every N lines to push the data to the browser as it generates, and I've used "table-layout: fixed" for the table's CSS class. It works pretty well in Netscape (7.1 and higher) - the table is drawn pretty much as the rows are received by the browser. However, Internet...
6
9998
by: anirban.anirbanju | last post by:
hi there, i've some serious problem to add rows dynamically in a table. my table contains 5 cell. | check | from_value | to_value | color_text | color_value | --------------------------------------------------------------------------------- | | | | | | | | | | |
2
2845
by: alexyz | last post by:
Hi everyone, I write a simple javascript to expand / collapse some rows of a table. The problem is that when I click more than one time the link to expand /collapse the rows I get an unwanted extra space after such rows. Can anyone help me to solve the problem (I use Firefox to test this code)? Here there is the sample code: <html> <head>
0
8701
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
9306
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
9168
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...
1
9068
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
7942
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
6621
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
5943
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
4715
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2103
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.