J
John Bullock
Hello,
I am at wit's end with an array sorting problem. I have a
simple table-sorting function which must, at times, sort on columns that
include entries with nothing but a space (@nbsp. I want all of the
spaces to be put in the first slots of the array. IE 6 does this. But
Firefox 0.9.1 doesn't, and I don't know why.
I have not been able to reproduce it in very simple form (which
is itself a puzzle). But example code is available at
http://cgi.stanford.edu/~bullock2/dirlist.pl?threat: at this page,
sorting on the "Size" column works as I want in IE, but not in Firefox.
I suspect that the problem lies with my code and not with the browsers.
For what it's worth, here is the sorting function:
function RowCompareNumbers(a, b) {
if (a.value==" " & b.value==" ") return 0;
else if (a.value==" ") return -1;
else if (b.value==" ") return 1;
else {
var aVal = parseInt(a.value);
var bVal = parseInt(b.value);
return (aVal - bVal);
}
}
(I know this can be made much more concise, but for the moment,
I'm not worried about it.)
There is also getInnerText() function which retrieves the text
from the table cells; it may be the culprit.
Many thanks,
--John
I am at wit's end with an array sorting problem. I have a
simple table-sorting function which must, at times, sort on columns that
include entries with nothing but a space (@nbsp. I want all of the
spaces to be put in the first slots of the array. IE 6 does this. But
Firefox 0.9.1 doesn't, and I don't know why.
I have not been able to reproduce it in very simple form (which
is itself a puzzle). But example code is available at
http://cgi.stanford.edu/~bullock2/dirlist.pl?threat: at this page,
sorting on the "Size" column works as I want in IE, but not in Firefox.
I suspect that the problem lies with my code and not with the browsers.
For what it's worth, here is the sorting function:
function RowCompareNumbers(a, b) {
if (a.value==" " & b.value==" ") return 0;
else if (a.value==" ") return -1;
else if (b.value==" ") return 1;
else {
var aVal = parseInt(a.value);
var bVal = parseInt(b.value);
return (aVal - bVal);
}
}
(I know this can be made much more concise, but for the moment,
I'm not worried about it.)
There is also getInnerText() function which retrieves the text
from the table cells; it may be the culprit.
Many thanks,
--John