文件关联

折腾了一个下午,终于实现了我想要的客户端文件关联的功能,与大家分享一下:)

<%@ page language="java"  import="java.util.*"  pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head >
   <script type="text/javascript">
  
   function f(){
   path="C://Windows//System32//notepad.exe %1"
   //alert(path);
   try{
     ///  al=document.applets[0];
     ///  a1.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}");
     ///  a1.createInstance();
      /// shili= a1.GetObject();
      var shili = document.getElementById("tt");
       alert(shili);
      try{
        shili.regwrite("HKCR//.daa//","daa—auto—file");
        shili.regwrite("HKCR//Applications//notepad.EXE//shell//","open");
  shili.regwrite("HKCR//Applications//notepad.EXE//shell//open//","");
  shili.regwrite("HKCR//Applications//notepad.EXE//shell//open//command//",path);
  shili.regwrite("HKCR//daa—auto—file//shell//","open");
  shili.regwrite("HKCR//daa—auto—file//shell//open//","");
  shili.regwrite("HKCR//daa—auto—file//shell//open//command//",path);
  }
  catch(e){
  
  }
  }
  catch(e){}
  
   }
   </script>
   <OBJECT ID="tt" CLASSID="clsid:F935DC22-1CF0-11D0-ADB9-00C04FD58A0B">
  </OBJECT>
  </head>
 
  <body >
  <a href="#" onclick="f()">关联</a>
  <a href="file:///E:/test.daa" >OK</a>
  </body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值