469,270 Members | 1,172 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

Firefox bug?

Hi,

to implement search by javascript function I use this code:

==============
function filterContacts(term, _id, cellNr){

var s = term.value.toLowerCase();
var table = document.getElementById(_id);
var ele;

for (var r = 0; r < table.rows.length; r++){
table.rows[r].style.display = 'none';
}
for (var r = 0; r < table.rows.length; r++){
ele = null;
if (table.rows[r] != null && table.rows[r].cells[cellNr] != null){
ele = table.rows[r].cells[cellNr].innerHTML;
if (ele.toLowerCase().indexOf(s)<0 ) {
table.rows[r].style.display = 'none';
} else {
table.rows[r].style.display = 'block';
}
}
}

}

===============

This works fine in IE,
but there are some bugs in Firefox.
There are a style.display bugs in firefox?

Thanks for any suggestion.
fabio

Apr 25 '07 #1
2 3337
"Fabio Maggi" <fa*****@tin.itwrote:
for (var r = 0; r < table.rows.length; r++){
ele = null;
if (table.rows[r] != null && table.rows[r].cells[cellNr] != null){
ele = table.rows[r].cells[cellNr].innerHTML;
if (ele.toLowerCase().indexOf(s)<0 ) {
table.rows[r].style.display = 'none';
} else {
table.rows[r].style.display = 'block';
}
}
}

}

===============

This works fine in IE,
but there are some bugs in Firefox.
There are a style.display bugs in firefox?
There probably are, but the bug here is in your code not Firefox.

don't try to set table rows to 'block' display style (except in the
Microsoft universe table rows have a 'table-row' display style): just clear
the display style to make it visible on all browsers:
} else {
table.rows[r].style.display = '';
}
Apr 26 '07 #2
Fabio Maggi a écrit :
Hi,

to implement search by javascript function I use this code:

==============
function filterContacts(term, _id, cellNr){

var s = term.value.toLowerCase();
What is term? A reference to an input or the name attribute of an input?
Firefox and IE6+ do not work the same way on referencing form input
controls.

Visit section 3.2 of this page:
Using Web Standards in your Web Pages
3.2 Accessing Elements with the W3C DOM
http://developer.mozilla.org/en/docs...your_Web_Pages
var table = document.getElementById(_id);
var ele;

for (var r = 0; r < table.rows.length; r++){
table.rows[r].style.display = 'none';
}
for (var r = 0; r < table.rows.length; r++){
ele = null;
if (table.rows[r] != null && table.rows[r].cells[cellNr] != null){
ele = table.rows[r].cells[cellNr].innerHTML;
if (ele.toLowerCase().indexOf(s)<0 ) {
table.rows[r].style.display = 'none';
} else {
table.rows[r].style.display = 'block';

For CSS 2.1 compliant browsers, the default display value of row element
is table-row. MSIE 6 and MSIE 7 do not support display: table-row. So
IE6+ has bugs, CSS 2.x bugs.
Also, MSIE 6 and MSIE 7 do not support visibility: collapse for table
rows and table columns; so again, MSIE 6+ has the bugs. Firefox 2
supports visibility: collapse for table rows.

Gérard
--
Using Web Standards in your Web Pages (Updated Dec. 2006)
http://developer.mozilla.org/en/docs...your_Web_Pages
Apr 26 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jeremy Epstein | last post: by
87 posts views Thread by expertware | last post: by
5 posts views Thread by SPE - Stani's Python Editor | last post: by
7 posts views Thread by Coder | last post: by
12 posts views Thread by amit | last post: by
6 posts views Thread by scotty | last post: by
7 posts views Thread by Carlos Mendonça | last post: by
3 posts views Thread by SAL | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.