• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 9. Using the document and body Objects > Handling File Dates and Sizes

Handling File Dates and Sizes

The document object also gives you access to web page dates and sizes in the Internet Explorer with the fileCreatedDate, fileModifiedDate, and fileSize properties. (Be warned, however—not all servers fill in the information in these properties properly.) Here’s an example that puts these properties to work, displaying the dates and size (in bytes) of a document:

(Listing 09-04.html on the web site)

<HTML> 
    <HEAD> 
        <TITLE>Getting File Size and Date</TITLE> 
        <SCRIPT LANGUAGE="JavaScript"> 
            <!--
            function getSizesDates()
					{
					document.writeln("Document created: " + document.fileCreatedDate)
					document.writeln("Last modified: " + document.fileModifiedDate)
					document.writeln("File size: " + document.fileSize)
					} 
            // --> 
        </SCRIPT> 
    </HEAD> 

    <BODY ONLOAD="getSizesDates()"> 
        <H1>Getting File Size and Date</H1> 
    </BODY> 
</HTML> 


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint