用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{
相关文档:
源代码如下:
<!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>
<title>验证邮箱地址合法性</title>
<sc ......
一、类型转换的方法和应该注意的问题:
1,转换为布尔型:
(1)用两次非运算(!):
!!5 ==> true
(2)用布尔型的构造函数:
new Boolean(5) == > true
值转换为布尔类型为false:
0,+0,-0,NaN,""(空字符串),undefined,null
除上面的值其他值在转换以后为true,需要特别提到的是:
"0",new Object(),funct ......
//把数据写入数据库
function
res(){
//获取输入值(myname和mymail是两个文本框的id)
var
uname = document.getElementById("myname"
).value;
var
umail = document.getElementById("mymail"
).value;
......
在web上编写菜单一直是比较头疼的事情,要是有个类直接套用就好了,最近又要做网站了,烦人,要求做的还是多级菜单,唉,废话少说,遇到问题就要解决啊,看代码:
function is(e, handler) {
if (e.type != 'mouseout' && e.type != 'mouseover ......