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£©Îªµ¥Î»¼ÆËãµÄÇý¶¯
Ïà¹ØÎĵµ£º
Yielding with Timers Óö¨Ê±Æ÷Èóöʱ¼äƬ
Despite your best efforts, there will be times when a JavaScript task cannot be completed in 100 milliseconds or less because of its complexity. In these cases, it's ideal to yield control of the UI thread so that UI updates may occur ......
Splitting Up Tasks ·Ö½âÈÎÎñ
What we typically think of as one task can often be broken down into a series of subtasks. If a single function is taking too long to execute, check to see whether it can be broken down into a series of smaller functions that complete in smaller ......
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.
µ±ÍøÒ³»òÓ¦ÓóÌÐò±äÂýʱ£¬·ÖÎ ......
JSON:
[{"subjecttypeId":"1","subjectName":"67","scope":"1",},{"subjecttypeId":"1","subjectName":"345","scope":"1"}]
JavaScript:
var result = window.eval('(' + JSON+ ')');
for(var p in result){
result[p].subjectName;
alert(result[p] ......