JS経由でファイルにアクセスする
2465 ワード
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
var s;
s=" ";
function ShowFolderFileList(i,folderspec)
{
var fso,f,fc,name;
var url,str,file,filename;
var i;
fso=new ActiveXObject("Scripting.FileSystemObject ");
f=fso.GetFolder(folderspec);
s+=i+++"\t "+f.Name+"\t
";
fc=new Enumerator(f.files);
for(;!fc.atEnd();fc.moveNext())
{
filename=fso.GetFileName(fc.item());
if(filename.indexOf(".url ")>=0)
{
filename=filename.substring(0,filename.length-4);
file=fso.GetFile(fc.item());
ts=file.OpenAsTextStream(1,0);
str=ts.ReadLine();
while(str.indexOf("URL= ")<0&&!ts.AtEndOfStream)
{
str=ts.ReadLine();
}
ts.Close();
s+=i+"\t "+filename+"\t "+str.substr(str.indexOf("URL= ")+4)+"
";
}
}
fc=new Enumerator(f.SubFolders);
for(;!fc.atEnd();fc.moveNext())
{
ShowFolderFileList(i,fc.item());
}
return (s);
}
function exet()
{
document.form1.tt.value=ShowFolderFileList(1,document.form1.t.value)
}
</SCRIPT>
<form name= "form1 " id="form1" method= "post " action= "favorite.asp?action=save ">
<input name= "t " type= "text " id= "t" value= "F:\ " size= "70 ">
<textarea name= "tt " id= "tt" cols= "120 " rows= "15 " wrap= "VIRTUAL "> </textarea>
<br>
<INPUT onclick=exet() type=button value= >
</form>
</BODY>
</HTML>