ÓÃJavaScript·â×°ÏÂFileSystemObject£¬×öÏÂÎļþ²Ù×÷£¡
/*
* To change this template, choose Tools | Templates
* and open the template in the editor
*/
var File = {
name:'',
path:'',
ext:'',
cfiles:[],
attributes:{
driver:'',
parentFolder:'',
shortName:'',
shortPath:'',
type:''
},
getInstance:function(){
var reObj = {};
this.path = arguments[0];
this.name = arguments[1];
Object.extend(reObj, this);
//³õʼ»¯FSO¶ÔÏó
try{
this.fso = new ActiveXObject("Scripting.FileSystemObject");
if(!(fso.FolderExists(this.path))){
fso.CreateFolder(this.path);
};
}catch(e){
alert(e.message);
return;
};
//Èç¹ûÊÇÎļþ¼Ð£¬»ñµÃ¸ÃÎļþ¼ÐÏÂËùÓÐÎļþ
if("" == this.name){
this.attributes.type = 'FOLDER';
var folder = fso.GetFolder(this.path);
this.cfiles = new Enumerator(folder.Files);
}else{
Ïà¹ØÎĵµ£º
¶þ¡¢¶¯Ì¬¸ø±í²åÈëÐУº
function addRow(){
//¶¯Ì¬²åÈëÒ»ÐÐ
var oRow1=mediaMes.insertRow(mediaMes.rows.length);
//ÉèÖÃtrµÄid
oRow1.id="tr"+thisId;
//»ñµÃ±í×ܵÄÐÐÊý
var aRows=mediaMes.rows;
//»ñµÃÐÂÌí¼ÓÐеÄÁм¯ºÏ
var aCells=oRow1. ......
ÄãÖªµÀÊÀ½çÉÏÓжàÉÙÖÖä¯ÀÀÆ÷Â𣿳ýÁËÎÒÃÇÊìÖªµÄIE, Firefox, Opera, SafariËÄ´óä¯ÀÀÆ÷Ö®Í⣬ÊÀ½çÉÏ»¹Óнü°ÙÖÖä¯ÀÀÆ÷¡£
¼¸Ììǰ£¬ä¯ÀÀÆ÷¼Ò×åÓиյ®ÉúÁËһλСÍõ×Ó£¬¾ÍÊÇGoogleÍÆ³öµÄChromeä¯ÀÀÆ÷¡£ÓÉÓÚChrome³öÉúÃûÃÅ£¬¾¡¹ÜËû»¹ÊǸöС¼Ò»ï£¬Ã»ÓÐÈ˸ÒС ......
Ê×ÏÈ¿´demo´úÂ룺
var student={
name:"leo",
intro:function(){
alert("my name is "+this.name);
}
}
var teacher=function(f){
f();
}
teacher(student.intro);
ÔÚÉÏÃæµÄdemo£¬¿ÉÒÔ¿´µ½ÏÔʽµÄ¶¨ÒåÁËÒ»¸ö¶ÔÏóstudent£¬ÓÐÒ»¸ö³ÉÔ±º¯ÊýintroºÍÒ»¸ö³ÉÔ±±äÁ¿¡£
ÁíÍⶨÒåÁËÒ»¸öº¯Êýteacher£¬½ÓÊ ......
javascript ÀඨÒå4ÖÖ·½·¨
Java´úÂë
/*
¹¤³§·½Ê½--- ´´½¨²¢·µ»ØÌض¨ÀàÐ͵ĶÔÏóµÄ ¹¤³§º¯Êý £¨ factory function £©
*/
function createCar(color,doors,mpg){
......