Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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(018)

String Trimming  ×Ö·û´®ÐÞ¼ô
    Removing leading and trailing whitespace from a string is a simple but common task. Although ECMAScript 5 adds a native string trim method (and you should therefore start to see this method in upcoming browsers), JavaScript has not historically in ......

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

JavaScript Minification  JavaScript½ô´Õ
    JavaScript minification is the process by which a JavaScript file is stripped of everything that does not contribute to its execution. This includes comments and unnecessary whitespace. The process typically reduces the file size by ha ......

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

µÚʮՠ Tools  ¹¤¾ß
    Having the right software is essential for identifying bottlenecks in both the loading and running of scripts. A number of browser vendors and large-scale websites have shared techniques and tools to help make the Web faster and more efficient. This ......

ÓÃJavaScriptдµÄСʱºòÍæµÄƹÅÒÇòСÓÎÏ·

ÓÉÓÚ»ðºüä¯ÀÀÆ÷²»Ö§³Ö“removeNode”º¯Êý£¬ËùÒÔһϴúÂëÖ»Ö§³ÖIE.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
< ......

JavaScript±à³Ì±Ê¼Ç

ÐÂÖÐ……
1¡¢Êý¾ÝÀàÐÍÑéÖ¤ÎÊÌâ
  Asp.NetËäÈ»ÓÐÑéÖ¤¿Ø¼þ£¬µ«ÊÇÓÐЩ¸´ÔÓµÄÑéÖ¤»¹Êǵô«µ½·þÎñÆ÷ÉϽøÐУ¬ÓÃjsËٶȺÍÐÔÄܶ¼±È½ÏºÃ
<script>
 //¼ì²éÊÇ·ñΪÈÎÒâÊý£¨ÊµÊý£©
function isNumeric(strNumber) {
var newPar=/^(-|\+)?\d+(\.\d+)?$/
alert(newPar.test(strNumber)); }
 //¼ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ