国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

硬盤瀏覽程序,保存成網(wǎng)頁格式便可使用

2019-11-21 02:26:16
字體:
供稿:網(wǎng)友
硬盤瀏覽程序,保存成網(wǎng)頁格式便可使用,放到隨意一個盤,不要放桌面就可以了
復(fù)制代碼 代碼如下:

<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+"http://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();
      }
   for(i=0;i<drive.length;i++)
      outstr+="[<a href='' id='drive"+drive[i]+"' onClick=/"driveactive(drive["+i+"]);return false;/">本地磁盤:"+drive[i]+"</a>]";
   outstr+="顯示隱藏內(nèi)容<input style='height:15px;border:none;' type='checkbox' id='showorhide' onClick='hidestate=this.checked;flashdrive();'>"
   document.getElementById("drives").innerHTML=outstr;
   getdata="";outstr="";
   /*Get the exist item.*/
   favpath=selfpath+"http://favinf.ini";
   if(fso.FileExists(favpath))
    {
      ffile=fso.OpenTextFile(favpath,1);
      if(!ffile.AtEndOfStream)
       {
          getdata=ffile.ReadAll().replace(//"|/s+/g,"");
          getdata=getdata.replace(/^/|+|/|+$/,"");
          getdata=getdata.replace(//|/|+/,"|");
          favorite=getdata.split("|");
       }
      ffile.Close();
      if(favorite[0]=="")
        favcounter=0;
      else
        favcounter=favorite.length;
    }
   else
    {
      ffile=fso.CreateTextFile(favpath,true);
      ffile.Close();
      favcounter=0;
    }  
   openfav();
   driveactive("C");
   getdata="";
}catch(errorinf){alert(errorinf.description+"/n/n請不要隨便改變數(shù)據(jù)文件*.ini文件中的內(nèi)容.");}
}
function driveactive(driveval)
{
try{  
   if(lastdrive==("drive"+driveval)&¤tdrive.match(/^[a-z]/://$/i))
     {
       document.getElementById("showorhide").focus();
       return false;
     }
   if(lastdrive=="")lastdrive="driveC";
   document.getElementById(lastdrive).style.backgroundColor="#CCCCCC";
   lastdrive="drive"+driveval;
   document.getElementById(lastdrive).style.backgroundColor="#FFFFDD";
   var att="",drv,totalsize,freespace,usespace,outstr="",pathstr="",attribu=0,subfolfil="",fcount=0;
   drv=fso.GetDrive(driveval);
   totalsize=Math.round((drv.TotalSize/Math.pow(2,30))*100)/100;
   freespace=Math.round((drv.FreeSpace/Math.pow(2,30))*100)/100;
   usespace=Math.round((totalsize-freespace)*100)/100;
   totalsize>1 ? totalsize+="GB":totalsize=totalsize*Math.pow(2,10)+"MB";
   freespace>1 ? freespace+="GB":freespace=freespace*Math.pow(2,10)+"MB";
   usespace>1 ? usespace+="GB":usespace=usespace*Math.pow(2,10)+"MB";
   att+="本地磁盤:"+driveval+"/n文件系統(tǒng):"+drv.FileSystem+"/n磁盤大小:"+totalsize+"/n已用空間:"+usespace+"/n可用空間:"+freespace+"/n";
   outstr="";
   currentdrive=pathstr=driveval+"://";
   ffolder=fso.GetFolder(pathstr+"http://").SubFolders;
   getdata=new Enumerator(ffolder);
   outstr="<div class='showcon'>文件夾:[<a href='' onclick=/"return unfurlorfold('folshow',this);/">隱藏</a>]<div id='folshow'>";
   ppathcounter=0;
   for(;!getdata.atEnd();getdata.moveNext())
    {
     attribu=getdata.item().Attributes;
     if(hidestate||attribu==16||attribu==17||attribu==48||attribu==49)
      {
        fcount++;
        ppath[ppathcounter]=driveval+"://"+getdata.item().name;
        outstr+="<div><a href='' onClick=/"folderactive(ppath["+ppathcounter+"]);"
        outstr+="return false;/">"+getdata.item().Name+"</a></div>";
        ppathcounter++;
      }
    }
   subfolfil="找到"+fcount+"個文件夾,";
   fcount=0;
   ffile=fso.GetFolder(pathstr).Files;
   getdata=new Enumerator(ffile);
   outstr+="</div></div><div class='showcon'>文  件:[<a href='' onclick=/"return unfurlorfold('filshow',this);/">隱藏</a>]<div id='filshow'>";
   for(;!getdata.atEnd();getdata.moveNext())
    {
     attribu=getdata.item().Attributes;
     if(hidestate||attribu==0||attribu==1||attribu==32||attribu==33)
      {
        fcount++;
        outstr+="<div><a href=/""+currentdrive+"/" target='_blank'>"+getdata.item().Name+"</a></div>";
      }
    } 
   outstr+="</div></div>";
   subfolfil+=fcount+"個文件.";
   document.getElementById("showcontent").innerHTML=outstr;
   document.getElementById("currentdrive").innerText=currentdrive;
   document.getElementById("showdriveatt").innerText=att;
   att="文件夾名稱:/n/n文件夾大小:/n創(chuàng)建時間:/n/n修改時間:/n/n訪問時間:/n/n";
   document.getElementById("showfolderatt").innerText=att;
   document.getElementById("subfolfil").innerText=subfolfil;
   att="[<a href=/""+currentdrive+"/" target='_blank'>打開</a>]";
   att+="[<a href='' onclick=/"addfav();return false;/">收藏</a>]";
   document.getElementById("openfol").innerHTML=att;
   document.getElementById("showorhide").focus();
   getdata="";
   }catch(errorinf){alert(errorinf.description+"/n/n請不要隨便改變數(shù)據(jù)文件*.ini文件中的內(nèi)容.");}
}
function folderactive(folderval)
{
try
{
   var att="",fol="",totalsize=0,sizesign="";
   openfolder(folderval);
   if(!folderval.match(/^[a-z]/://$/i))
    {
     fol=fso.GetFolder(folderval);
     totalsize=fol.Size/Math.pow(2,30);
     totalsize>1 ? sizesign="GB":(totalsize=totalsize*Math.pow(2,10),sizesign="MB");
     (totalsize<1 && sizesign=="MB") ? (totalsize=totalsize*Math.pow(2,10),sizesign="KB"):{}
     totalsize=Math.round((totalsize)*100)/100+sizesign;
     att+="文件夾名稱:/n"+fol.Name+"/n文件夾大小:"+totalsize+"/n創(chuàng)建時間:/n";
     att+=fol.DateCreated+"/n修改時間:/n"+fol.DateLastModified+"/n訪問時間:/n"+fol.DateLastAccessed;
     document.getElementById("showfolderatt").innerText=att+"/n";
    }
}catch(errorinf){alert(errorinf.description+"/n/n請不要隨便改變數(shù)據(jù)文件*.ini文件中的內(nèi)容.");}
}
function openfolder(currfolder)
{
try
{
   var sign=0,outstr="",attribu=0,subfolfil="",fcount=0;
   if(currfolder==""){alert("沒有選擇文件夾.");return false;}
   currentdrive=currfolder;
   ffolder=fso.GetFolder(currfolder).SubFolders;
   getdata=new Enumerator(ffolder);
   outstr="<div class='showcon'>文件夾:[<a href='' onclick=/"return unfurlorfold('folshow',this);/">隱藏</a>]<div id='folshow'>";
   ppathcounter=0;
   for(;!getdata.atEnd();getdata.moveNext())
    {
     attribu=getdata.item().Attributes;
     if(hidestate||attribu==16||attribu==17||attribu==48||attribu==49)
      {
        fcount++;
        ppath[ppathcounter]=currfolder.replace(///+$/i,"")+"http://"+getdata.item().name;
        outstr+="<div><a href='' onClick=/"folderactive(ppath["+ppathcounter+"]);"
        outstr+="return false;/">"+getdata.item().Name+"</a></div>";
        ppathcounter++;
      }
    }
   subfolfil="找到"+fcount+"個文件夾,";
   fcount=0;
   ffile=fso.GetFolder(currfolder).Files;
   getdata=new Enumerator(ffile);
   outstr+="</div></div></div><div class='showcon'>文  件:[<a href='' onclick=/"return unfurlorfold('filshow',this);/">隱藏</a>]<div id='filshow'>";
   for(;!getdata.atEnd();getdata.moveNext())
    {
     attribu=getdata.item().Attributes;
     if(hidestate||attribu==0||attribu==1||attribu==32||attribu==33)
      {
        fcount++;
        if(openfromfav==0)
          outstr+="<div><a href=/""+currentdrive+"/" target='_blank'>"+getdata.item().Name+"</a></div>";
        else
          outstr+="<div><a href=/""+currentdrive+"http://"+getdata.item().Name+"/" target='_blank'>"+getdata.item().Name+"</a></div>";
      }
    }   
   outstr+="</div></div>";  
   subfolfil+=fcount+"個文件.";
   document.getElementById("showcontent").innerHTML=outstr;
   document.getElementById("currentdrive").innerText=currentdrive;
   att="文件夾名稱:/n/n文件夾大小:/n創(chuàng)建時間:/n/n修改時間:/n/n訪問時間:";
   document.getElementById("showfolderatt").innerText=att;
   document.getElementById("subfolfil").innerText=subfolfil;
   att="[<a href=/""+currentdrive+"/" target='_blank'>打開</a>]";
   att+="[<a href='' onclick=/"addfav();return false;/">收藏</a>]";
   document.getElementById("openfol").innerHTML=att;
   getdata="";
   openfromfav=0;
  }catch(errorinf){alert(errorinf.description+"/n/n請不要隨便改變數(shù)據(jù)文件*.ini文件中的內(nèi)容.");}
}
function upfile()
{
   var rootpath="";
   rootpath=currentdrive;
   if(!rootpath.match(/^[a-z]/://$/i))
     {
        rootpath=rootpath.replace(///[^//]*$/,"");
        if(rootpath.match(/^[a-z]/:$/i)){rootpath+="http://";}
        folderactive(rootpath);
     }
   else
     alert("驅(qū)動器根目錄.");
}
function flashdrive()
{
  folderactive(currentdrive);
}
function openfav()
{
   lastfav="";
   var outstr="",i=0;
   for(i;i<favcounter;i++)
    {
      outstr+="<a id='fav"+i+"' href='' onclick=/"openfromfav=1;folderactive(favorite["+i+"]);"
      outstr+="favactive(this.id);return false;/" target='_blank'>"+favorite[i].replace(/^.+///,"")+"</a><br>";
    }
   document.getElementById("showfavorite").innerHTML=outstr;
   document.getElementById("delfav").value="";
}
function favactive(favid)
{
   var i=parseInt(favid.match(//d/));
   if(lastfav!="")
      document.getElementById(lastfav).style.backgroundColor="#CCCCCC";
   lastfav=favid;
   document.getElementById("delfav").value=favorite[i];
   document.getElementById(lastfav).style.backgroundColor="#FFFFDD";
   document.getElementById("showorhide").focus();
}
function addfav()
{
try
{
   if(currentdrive.match(/^[a-z]/://$/i))
     {
       alert("只能收藏文件夾.");
       return false;
     }
   var i=0;
   for(i=0;i<favcounter;i++)
     {
       if(favorite[i]==currentdrive)
         {
            alert("常用文件夾中已經(jīng)存在該文件夾.");
            return false;
         }
     }
   if(fso.FileExists(favpath))
     {
       ffile=fso.OpenTextFile(favpath,8);
     }
   else
     {
       ffile=fso.CreateTextFile(favpath,true);
     }
   ffile.Write("|"+currentdrive);
   ffile.Close();
   favorite[favcounter]=currentdrive;
   favcounter++;
   openfav();
   alert("添加成功.");
}catch(errorinf){alert(errorinf.description+"/n/n請不要隨便刪除數(shù)據(jù)文件*.ini文件.");}
}
function delfav()
{
try
{
   var delpath=document.getElementById("delfav").value;
   var i=lastfav.match(//d/),j=parseInt(i);
   var newfav="";
   document.getElementById("showorhide").focus();
   if(delpath=="")
     {
        alert("沒有選擇常用文件夾.");
        return false;
     }
   if(confirm("確定刪除常用文件夾(并非從硬盤刪除):/n"+delpath+"/n?"))
     {
        favcounter--;
        for(j;j<favcounter;j++)
          favorite[j]=favorite[j+1];
        for(j=0;j<favcounter;j++)
          newfav+=favorite[j]+"|";
        ffile=fso.OpenTextFile(favpath,2);
        newfav=newfav.replace(/^/||/|$/,"");
        ffile.WriteLine(newfav);
        ffile.Close();
        openfav();
        document.getElementById("delfav").value="";
        alert("刪除成功.");
     }

}catch(errorinf){document.getElementById("delfav").value="";alert(errorinf.description+"/n/n請不要隨便刪除數(shù)據(jù)文件*.ini文件.");}
}
function unfurlorfold(objid,obj)
{
  if(obj.innerText=="隱藏")
     {
       obj.innerText="顯示";
       document.getElementById(objid).style.display="none";
     }
  else
     {
       obj.innerText="隱藏";
       document.getElementById(objid).style.display="";
     }  
  document.getElementById("showorhide").focus(); 
  return false;  
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>FileLookThroughAdmin V1.0</title>
<style type="text/css">
<!--
body{
background-color:#EEEEEE;}

div.main{
background-color:#CCCCCC;
width:100%;
padding:6px 10px 10px;}

h1{font-size:36px;
font-family:"華文彩云";
color:#0000FF;}

hr{
width:95%;
text-align:left;}

table.tableclass{
table-layout:fixed;
word-wrap:break-word;
width:100%;
font-size:12px;
background-color:#EEEEEE;}
table.tableclass td{
background-color:#CCCCCC;}

#drive{}
td.drvinf{
vertical-align:top;
padding:5px;}
td.folderfile{
height:430px;
vertical-align:top;}
td.folderfile div.showcon{
width:100%;}
td.folderfile div.showcon div div{
padding:1px 0px;
width:49%;
float:left;}

a:link{text-decoration:none;
color:#0000FF;}
a:active{text-decoration:none;
color:#0000FF;}
a:visited{text-decoration:none;
color:#0000FF;}
a:hover{
text-decoration:underline;
color:#FF0000;
background-color:#FFFFDD;}

.button{
border:none;
height:20px;
width:50px;
background-color:#CCCCCC;}

td.fav{
vertical-align:top;
padding:5px;}
-->
</style>
</head>
<body onLoad="javascript:initdoc();status='FileLookThroughAdmin V1.0';">
<div class="main">
  <h1>FileLookThroughAdmin</h1>
  <div style="margin-top:-36px;"><hr></div>
  <div style="margin-top:-14px;position:relative;left:5%;"><hr></div>
  <div>
    <table class="tableclass">
      <tr align="center">
        <td width="18%">收藏夾</td>
        <td width="60%">文件夾及文件</td>
        <td>相關(guān)信息</td>
      </tr>
      <tr>
        <td align="center">
          HardDrives>>
        </td>
        <td colspan="2">
          <div id="drives"></div>
        </td>
      </tr>
      <tr>
        <td align="center">
          Tag>>
        </td>
        <td align="center" colspan="2">
          DisplayContent
        </td>
      </tr>
      <tr>
        <td align="center">
          CurrentPath>>
        </td>
        <td colspan="2">
          <div id="currentdrive"></div>
        </td>
      </tr>
      <tr>
        <td class="fav">
          <div>常用文件夾:</div>
          <div id="showfavorite"></div>
        </td>
        <td rowspan="2" class="folderfile">
          <div onclick="upfile();" style="height:15px;cursor:pointer;padding-top:5px;" align="center"
           onmouseover="this.style.backgroundColor='#FFFFDD';"
           onmouseout="this.style.backgroundColor='#CCCCCC';">
          上一級目錄</div>
          <div id="showcontent" style="padding-left:5px;"></div>
        </td>
        <td rowspan="2" class="drvinf">
          <font color="#FF0000">當(dāng)前驅(qū)動器信息:</font>
          <div id="showdriveatt"></div>
          <font color="#FF0000">當(dāng)前文件夾信息:</font>
          <span id="openfol"></span>
          <div id="showfolderatt"></div>
          <div id="subfolfil" style="color:#FF0000;"></div>
        </td>
      </tr>
      <tr>
        <td class="fav">
          <div>刪除常用文件夾:</div><br>
          <div align="center">
            P:<input id="delfav" type="text" style="border:none;" readonly><br><br>
            [<a href="" onClick="delfav();return false;">執(zhí)行刪除</a>]
          </div>
        </td>
      </tr>
    </table>
  </div>
</div>
<div>
  <font style="font-size:12px;cursor:default;" color="#666666" onmouseover="this.color='#FF0000'" onmouseout="this.color='#666666'">
    Design:sgw.LKing(∮LKing♂)[FS:Ecjtu2006|QQ:28857496|E-Mail:sgw.lking@gmail.com][@06.11]
  </font>
</div>
</body>
</html>

上一篇:Js的MessageBox

下一篇:常用js腳本

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 五峰| 海兴县| 疏勒县| 花莲县| 仲巴县| 瑞金市| 武川县| 安图县| 海伦市| 射阳县| 海林市| 旌德县| 姜堰市| 饶阳县| 奇台县| 汝城县| 永登县| 河池市| 乳山市| 江华| 威海市| 南和县| 五指山市| 浮山县| 利川市| 安顺市| 博乐市| 那曲县| 策勒县| 台北市| 彭水| 苗栗市| 报价| 成都市| 自贡市| 新沂市| 大竹县| 玛多县| 方山县| 大庆市| 蕉岭县|