验证图片格式

</head>
<body>
<!-- picrotate_left start  -->
<div class="blk_18"> <a class="LeftBotton" onmousedown="ISL_GoUp_1()" onmouseup="ISL_StopUp_1()" onmouseout="ISL_StopUp_1()" href="javascript:void(0);" target="_self"></a>
  <div class="pcont" id="ISL_Cont_1">
    <div class="ScrCont">
      <div id="List1_1">
        <!-- piclist begin -->
        <ul id="bigs">
       
        </ul>
        <!-- piclist end -->
      </div>
      <div id="List2_1"></div>
    </div>
  </div>
  <a class="RightBotton" onmousedown="ISL_GoDown_1()" onmouseup="ISL_StopDown_1()" onmouseout="ISL_StopDown_1()" href="javascript:void(0);" target="_self"></a> </div>
<div class="c"></div>
<script type="text/javascript">
        <!--
        picrun_ini()
        //-->
</script>
<!-- picrotate_left end -->
<script type="text/javascript">
var fso=new ActiveXObject("Scripting.FileSystemObject");

function showImages(folder)
{   
      var filePath=folder.value;
      var p=filePath.lastIndexOf("\\");
      if(p==-1)
      return ;
     
      var path=filePath.substr(0,p);
  var f=fso.GetFolder(path);  //获得目录对象
      var s="";
      var m="";
    
      var ff=new Enumerator(f.Files);     //该目录下所有的文件集合  
      for(;!ff.atEnd();ff.moveNext())  
      {         
            s+=ff.item();            
            s+=",";
      }

     if(document.getElementById("bigs"))
{
   var list=s.split(',');
       for(var i=0;i<list.length-1;i++)
   {
var imgUrl=list[i];
  var li_obj=document.createElement('li');
var img_obj=document.createElement("<img src="+imgUrl+" alt='' onclick='click1(this)'>");
li_obj.appendChild(img_obj);
document.getElementById("bigs").appendChild(li_obj);
   }
}
}

/*
function browseFolder(path) {
    try {
        var Message = "请选择一个图片文件夹";  //选择框提示信息
        var Shell = new ActiveXObject("Shell.Application");
        var Folder = Shell.BrowseForFolder(0,Message,0,'');//起始目录为:我的电脑
        if (Folder != null) {
            Folder = Folder.items();  // 返回 FolderItems 对象
            Folder = Folder.item();  // 返回 Folderitem 对象
            Folder = Folder.Path;   // 返回路径
            if (Folder.charAt(Folder.length - 1) != "\\") {
                Folder = Folder + "\\";
            }         
    showImages(Folder);         
        }
    }
    catch (e) {
        alert(e.message);
    }
}

String.prototype.IsPicture = function()
{     
        var strFilter=".jpeg|.gif|.jpg|.png|.bmp|.pic|"
        if(this.indexOf(".")>-1)
        {
            var p = this.lastIndexOf(".");        
            var strPostfix=this.substring(p,this.length) + '|';       
            strPostfix = strPostfix.toLowerCase();          
            if(strFilter.indexOf(strPostfix)>-1)
            {             
                return true;
            }
        }         
        return false;           
}
*/

function click1(img){
document.getElementById("showImg").src = img.src;
}
</script>
<!--
<input type="button" onClick="browseFolder('path')" value="选择图片" />
  -->

<input type="file" name="picpath" id="picpath" style="display:none" onChange="showImages(this)">
<input type="button" value="Browse" onclick="document.all.picpath.click()">

<div class="big-img"><img id="showImg" width="500" height="375" src="#" alt="" /></div>
</body>

你可能感兴趣的:(prototype,F#)