Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavascriptÎļþ¼°Îļþ¼Ð²Ù×÷

JavascriptÎļþ¼°Îļþ¼Ð²Ù×÷
 
Ò»¡¢¹¦ÄÜʵÏÖºËÐÄ£ºFileSystemObject ¶ÔÏó
    ÒªÔÚjavascriptÖÐʵÏÖÎļþ²Ù×÷¹¦ÄÜ£¬Ö÷Òª¾ÍÊÇÒÀ¿¿FileSystemobject¶ÔÏó¡£
¶þ¡¢FileSystemObject±à³Ì
ʹÓÃFileSystemObject ¶ÔÏó½øÐбà³ÌºÜ¼òµ¥£¬Ò»°ãÒª¾­¹ýÈçϵIJ½Ö裺 ´´½¨FileSystemObject¶ÔÏó¡¢Ó¦ÓÃÏà¹Ø·½·¨¡¢·ÃÎʶÔÏóÏà¹ØÊôÐÔ ¡£
£¨Ò»£©´´½¨FileSystemObject¶ÔÏó
´´½¨FileSystemObject¶ÔÏóµÄ´úÂëÖ»Òª1ÐУº
var fso = new ActiveXObject("Scripting.FileSystemObject");
ÉÏÊö´úÂëÖ´Ðкó£¬fso¾Í³ÉΪһ¸öFileSystemObject¶ÔÏóʵÀý¡£
£¨¶þ£©Ó¦ÓÃÏà¹Ø·½·¨
´´½¨¶ÔÏóʵÀýºó£¬¾Í¿ÉÒÔʹÓöÔÏóµÄÏà¹Ø·½·¨ÁË¡£±ÈÈ磬ʹÓÃCreateTextFile·½·¨´´½¨Ò»¸öÎı¾Îļþ£º
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f1 = fso.createtextfile("c:\\myjstest.txt",true");
£¨Èý£©·ÃÎʶÔÏóÏà¹ØÊôÐÔ
Òª·ÃÎʶÔÏóµÄÏà¹ØÊôÐÔ£¬Ê×ÏÈÒª½¨Á¢Ö¸Ïò¶ÔÏóµÄ¾ä±ú£¬Õâ¾ÍҪͨ¹ýgetϵÁз½·¨ÊµÏÖ£ºGetDrive¸ºÔð»ñÈ¡Çý¶¯Æ÷ÐÅÏ¢£¬GetFolder¸ºÔð»ñÈ¡Îļþ¼ÐÐÅÏ¢£¬GetFile¸ºÔð»ñÈ¡ÎļþÐÅÏ¢¡£±ÈÈ磬ָÏòÏÂÃæµÄ´úÂëºó£¬f1¾Í³ÉΪָÏòÎļþc:\test.txtµÄ¾ä±ú£º
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f1 = fso.GetFile("c:\\myjstest.txt");
È»ºó£¬Ê¹ÓÃf1·ÃÎʶÔÏóµÄÏà¹ØÊôÐÔ¡£±ÈÈ磺
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f1 = fso.GetFile("c:\\myjstest.txt");
alert("File last modified: " + f1.DateLastModified);
Ö´ÐÐÉÏÃæ×îºóÒ»¾äºó£¬½«ÏÔʾc:\myjstest.txtµÄ×îºóÐÞ¸ÄÈÕÆÚÊôÐÔÖµ¡£
µ«ÓÐÒ»µãÇë×¢Ò⣺¶ÔÓÚʹÓÃcreate·½·¨½¨Á¢µÄ¶ÔÏ󣬾Ͳ»±ØÔÙʹÓÃget·½·¨»ñÈ¡¶ÔÏó¾ä±úÁË£¬Õâʱֱ½ÓʹÓÃcreate·½·¨½¨Á¢µÄ¾ä±úÃû³Æ¾Í¿ÉÒÔ£º
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f1 = fso.createtextfile("c:\\myjstest.txt",true");
alert("File last modified: " + f1.DateLastModified);
Èý¡¢²Ù×÷Çý¶¯Æ÷£¨Drives£©
ʹÓÃFileSystemObject¶ÔÏóÀ´±à³Ì²Ù×÷Çý¶¯Æ÷£¨Drives£©ºÍÎļþ¼Ð£¨Folders£©ºÜÈÝÒ×£¬Õâ¾ÍÏóÔÚWindowsÎļþä¯ÀÀÆ÷ÖжÔÎļþ½øÐн»»¥²Ù×÷Ò»Ñù£¬±ÈÈ磺¿½±´¡¢Òƶ¯Îļþ¼Ð£¬»ñÈ¡Îļþ¼ÐµÄÊôÐÔ¡£
£¨Ò»£©Drives¶ÔÏóÊôÐÔ
Drive¶ÔÏó¸ºÔðÊÕ¼¯ÏµÍ³ÖеÄÎïÀí»òÂß¼­Çý¶¯Æ÷×ÊÔ´ÄÚÈÝ£¬Ëü¾ßÓÐÈçÏÂÊôÐÔ£º
l TotalSize£ºÒÔ×Ö½Ú£¨byte£©Îªµ¥Î»¼ÆËãµÄÇý¶¯


Ïà¹ØÎĵµ£º

[·­Òë]High Performance JavaScript(023)

Data Formats  Êý¾Ý¸ñʽ
    When considering data transmission techniques, you must take into account several factors: feature set, compatibility, performance, and direction (to or from the server). When considering data formats, the only scale you need for comparison is speed.
......

[·­Òë]High Performance JavaScript(029)

Working Around Caching Issues  ¹ØÓÚ»º´æÎÊÌâ
    Adequate cache control can really enhance the user experience, but it has a downside: when revving up your application, you want to make sure your users get the latest version of the static content. This is accomplished by renaming ......

[·­Òë]High Performance JavaScript(031)

Firebug
    Firefox is a popular browser with developers, partially due to the Firebug addon (available at http://www.getfirebug.com/), which was developed initially by Joe Hewitt and is now maintained by the Mozilla Foundation. This tool has increased the productivity of web develop ......

[·­Òë]High Performance JavaScript(032)

Fiddler
    Fiddler is an HTTP debugging proxy that examines the assets coming over the wire and helps identify any loading bottlenecks. Created by Eric Lawrence, this is a general purpose network analysis tool for Windows that provides detailed reports on any browser or web request. ......

[·­Òë]High Performance JavaScript(033)

Summary  ×ܽá
    When web pages or applications begin to feel slow, analyzing assets as they come over the wire and profiling scripts while they are running allows you to focus your optimization efforts where they are needed most.
    µ±ÍøÒ³»òÓ¦ÓóÌÐò±äÂýʱ£¬·ÖÎ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ