Click to See Complete Forum and Search --> : document.fileSize


nroose
07-20-2003, 01:09 AM
I am trying to use document.fileSize in the onload event of my pages. It works in html, but not in asp (it works in IE 5.0, but not in IE 5.5 or IE 6.0). Does anyone know any details about this DHTML method?

Thanks,

- Nick

nroose
07-20-2003, 11:01 AM
I am trying to find out size of dynamically generated page. I am using the document.fileSize in javascript that runs on the client. I generate the page based on information in a sql server db. Therefor, fso will not get me the information I want. document.fileSize works for simple test asp pages, but not in my app. It works in IE 5.0 but not in IE 5.5 and 6.0.

- Nick

nroose
07-20-2003, 09:21 PM
Below is some code for a page that has the javascript function on it that works in all recent versions of MSIE. However, for some reason, that I have not determined, if I put the same function on a page in my app, it only works in MSIE 5 and not MSIE 5.5 or MSIE 6. It works in MSIE 6 if I save the html and then view the html in the browser.

As you can see, I have added things like response buffering and include files that I use in my app in an effort to find the problem.

I am asking if anyone who reads this forum can tell me under what conditions the javascript DOM/DHTML attribute/property document.fileSize works and does not work. I have also posted this to a javascript forum. Perhaps I need to find a DHTML forum...

*****
<%@ Language=VBScript %>
<%
Response.Buffer = True
%>
<html>
<title>file size test</title>
<script type=text/javascript language="JavaScript">
<!-- hide from JavaScript-challenged browsers

function pageLoad(){
var fileSize;
try{
fileSize = document.fileSize * 1;
} catch (e){
fileSize = 0;
}
var y = document.images;
var imglength = 0;
for (i=0;i<y.length;i++)
{
imglength += (y[i].fileSize)*1;
}
htmlString = '';
if (fileSize > 0){
htmlString = htmlString + '(' + fileSize + ' bytes) ';
}
if (y.length > 0){
htmlString = htmlString + '(' + y.length + ' images for ' + imglength + ' bytes)';
}
htmlString = htmlString + '</small>';
try{
footerbottom.insertAdjacentHTML("afterBegin", htmlString);
} catch (e) {
//do nothing
}
}

// done hiding -->
</script>
</head>
<body onload='pageLoad();'>
<img src="http://www.timeeclipse.com/TE-logo.jpg">
<div name=footerbottom ID=footerbottom></div>
</body>
</html>
<!--#INCLUDE FILE="test.asp"-->
<%
Response.Flush
%>
*****