其实很简单,

<input type="file" >  

 这个就是html,call出文件对话框的。设置了隐藏。

只需要用javascript,或是jquery,用click函数call出,id为file就可以了。

<html>  
<head>  
   <title> New Document </title>  
</head>  
<body>  
<input type="file" >  
<input type="button" value="click" onClick="ok()">  
</body>  
<script language="JavaScript"> 
function ok(){  
var s = document.getElementById("file");  
s.click();  
}  
</script>  
</html>  

  

<html>  
<head>  
   <title> New Document </title>  
</head>  
<body>  
   <input type="button" value="保存" onclick="document.execCommand('SaveAs')">  
</body>  
<script language="JavaScript"> 
      function SaveAs()  
   {  
    var fileSave = new ActiveXObject("MSComDlg.CommonDialog");  
    fileSave.Filter = "mp3";  
          fileSave.FilterIndex = 2;  
          // 必须设置MaxFileSize. 否则出错  
          fileSave.MaxFileSize = 128;  
          fileSave.ShowOpen();  
      }  
</script>  
</html>  

  

相关文章:

  • 2021-05-21
  • 2021-07-09
  • 2021-08-22
  • 2021-04-06
  • 2022-12-23
  • 2021-11-16
  • 2021-07-15
  • 2021-12-29
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-18
  • 2021-09-30
  • 2021-06-09
  • 2022-12-23
相关资源
相似解决方案