js实用功能之--shell

shell大家应该都不陌生吧,就是用来调用机器上的磁盘文件的

下面介绍2种我知道的js的shell功能

那废话不多说,直接上码:

第一种:使用objShell对象

<script>

var objShell = new ActiveXObject("wscript.shell");
objShell.Run(文件路径);
objShell = null;s

</script>

第二种:使用object对象,使用这个对象时,codebase属性需要一个.dll文件进行处理,安全性更高,功能也更加强大

<script language="javascript" >
    function showmap()
    {
     oShell.Exec("CurrentUser","需要调用的文件");
    }
</script>

<html>

<IMG id="IMG1" onclick="showmap();" src="xx.gif" />

 <object id="oShell" codebase="http://www.cnblogs.com/CAB/App.CAB#version=1,0,0,0"
        style="display: none;">
    </object> 

</html>

posted @ 2011-05-06 12:50  J先生不太忙  Views(716)  Comments(0)    收藏  举报