473,387 Members | 3,750 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,387 software developers and data experts.

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 setObjectVisibility(objectID,state)
{
styleObject = dom(objectID,1);
styleObject.display = 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 2959


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 setObjectVisibility(objectID,state)
{
styleObject = dom(objectID,1);
styleObject.display = 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.display = 'none'
to hide an element and
element.style.display = '';
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*********************@c13g2000cwb.googlegro ups.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 setObjectVisibility(objectID,state)
{
styleObject = dom(objectID,1);
styleObject.display = 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.display = 'none'
to hide an element and
element.style.display = '';
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:none"
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
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...
3
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...
3
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...
5
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...
13
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...
4
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...
4
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...
6
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
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.