fso获取本地目录显示图片

来源:互联网 发布:linux安装ipython 编辑:程序博客网 时间:2024/09/21 09:00
<!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" id="h"name="h"class="h">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
// JavaScript
var dizhi,f,fc,jso,fso,wenjianming,name,ci,shu=0,jqu="[{",jq="},{",jiequq,jiequw,jiequa,jiequ;
$(function(){
 $("body div").click(function(){
     name=$(this).attr("id");
 if(name=="dian"){
          wenjianming = $("#b1").val();
 fso = new ActiveXObject("Scripting.FileSystemObject");
 f  =  fso.GetFolder(wenjianming);  
       fc =  new   Enumerator(f.files);jso= jqu;
     for   (;!fc.atEnd();fc.moveNext())  
           {  
                  dizhi =  fc.item()+"";
 jiequ = dizhi.substring(wenjianming.length+1);
     jso+="\"name\":\""+jiequ+"\"";jso+=jq;
     }
 jso+="}]"; $("#d").append(jso);
 ci=eval(jso);
 jiequq =dizhi.substring(1,-2);
    jiequw =dizhi.substring(2,wenjianming.length+1);
 jiequa = "file:///"+jiequq+"|"+jiequw;
 $("#j").html("<img id=\"t\"name=\"t\"class=\"t\" src=\""+jiequa+""+ci[0].name+"\">");
 }
 if(name=="y")
 {
if(shu==ci.length-1){
shu=0;$("#d").append("第0幅/共"+(ci.length-1)+"幅");
}
shu++;
$("#d").html("第"+shu+"幅/共"+(ci.length-1)+"幅");
$("#j").html("<img id=\"t\"name=\"t\"class=\"t\" src=\""+jiequa+""+ci[shu].name+"\">");
 }
 if(name=="z")
 {
if(shu==0){
   shu=ci.length;
$("#d").html("第"+(ci.lengtjh-1)+"幅/共"+(ci.length-1)+"幅");
}
shu--; 
$("#d").html("第"+shu+"幅/共"+(ci.length-1)+"幅");
$("#j").html("<img id=\"t\"name=\"t\"class=\"t\" src=\""+jiequa+""+ci[shu].name+"\">");
 }
});
});
0 0