SV: [thelist] Recieved number of bytes (cleaned up script)
Andreas Wahlin
Andreas.Wahlin at ufl.gu.se
Tue Jun 22 08:49:38 CDT 2004
Sorry for flaming!
This is a more cleaned up version of the script which seems to work
perfectly
function weigh() {
var size = 0;
for (var i = 0; i < document.images.length; i++)
size += parseInt(document.images[i].fileSize);
size += parseInt(document.fileSize);
size = new String(size);
for(var i = size.length-1, j = 1; i > 0; i--, j++)
if (j/3 == Math.ceil(j/3))
size = size.substring(0, i) + ',' +
size.substring(i, size.length);
alert('This page weighs '+size+' bytes.');
}
If any javascript gurus out there can detect any real difference, please
say so.
It still doesen't work in mozilla though, reasen seeming to be that
mozilla (firefox) doesen't have the image.fileSize attribute that IE
seems to have. Is this true?
Andreas
More information about the thelist
mailing list