首页 > 开发 > JS > 正文

硬盘浏览程序,保存成网页格式便可使用

2024-09-06 12:44:19
字体:
来源:转载
供稿:网友
硬盘浏览程序,保存成网页格式便可使用,放到随意一个盘,不要放桌面就可以了
代码如下:
<html>
<head>
<script language="javascript" type="text/javascript">
var errorinf=new Error();
var fso,fdrive,ffolder,ffile;
var getdata="",selfpath="",drvpath="",favpath="";
var drive=new Array(),favorite=new Array();
var currentdrive="";
var hidestate=false;
var lastdrive="",lastfav="";
var ppath=new Error(),ppathcounter=0,favcounter=0;
var openfromfav=0;
function initdoc()
{
try
{
   var outstr="",counter=0,i=0,writestr="";
   fso=new ActiveXObject("Scripting.FileSystemObject");
   selfpath=fso.GetParentFolderName(location.pathname.replace(////,""));
   drvpath=selfpath+"//drvinf.ini";
   /*Get the hard drives on the computer.*/
   if(!fso.FileExists(drvpath))
      {
         fdrive=fso.Drives;
         getdata=new Enumerator(fdrive);
         for(;!getdata.atEnd();getdata.moveNext())
           if(getdata.item().DriveType==2)
             {
                drive[counter]=getdata.item().DriveLetter;
                writestr+=drive[counter]+"$";
                counter++;
              }
         ffile=fso.CreateTextFile(drvpath,true);
         writestr=writestr.replace(//$$/,"");
         ffile.WriteLine(writestr+"/r");
         ffile.Close();
      }
   else
      {
        ffile=fso.OpenTextFile(drvpath,1);
        getdata=ffile.ReadAll().replace(//'|/"|//|//|/:|/s+/g,"");
        getdata=getdata.replace(/^/$+|/$+$/,"");
        getdata=getdata.replace(//$/$+/,"$");
        drive=getdata.split("$");
        ffile.Close();
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表