当前位置: 代码迷 >> JavaScript >> JS代码-打开当地程序
  详细解决方案

JS代码-打开当地程序

热度:167   发布时间:2012-10-24 14:15:58.0
JS代码--打开本地程序
<style> 
<!-- 
body, table, p, td, div,select { font:menu} 
.button {boder:0; HEIGHT: 19px;width:66px;cursor:hand;font:menu;border-left-width:1; border-left-color:#000000;  border-bottom-width:1; border-bottom-color:#000000; border-right-width:1; border-right-color:#000000; border-top-width:1; border-top-color:#000000; background-color:#FFFFFF;} 
--> 
</style> 

<SCRIPT language=JavaScript> 
function Run(strPath) { 
exe.value=strPath; 
try { 
var objShell = new ActiveXObject("wscript.shell"); 
objShell.Run(strPath); 
objShell = null; 
} 
catch (e){alert('找不到文件"'+strPath+'"(或它的组件之一)。请确定路径和文件名是否正确后,再试一次。') 
} 
} 
</SCRIPT> 
<p>
请键入程序、文件夹、文档或 Internet 资源的名称,Windows将为您打开它。<br>
打开: <input name=exe style="border-left-width:1; border-left-color:#000000;  border-bottom-width:1; border-bottom-color:#000000; border-right-width:1; border-right-color:#000000; border-top-width:1; border-top-color:#000000;" type=text onFocus="this.select()" value="notepad" size=40> 
<BUTTON class=button onClick="Run(exe.value)">确定</BUTTON> 
<BUTTON class=button onclick=exe.value="";>重新输入</BUTTON><br> <BR>
<BUTTON class=button onClick="Run('Notepad')">记事本</BUTTON> 
<BUTTON class=button onClick="Run('Mspaint')">画图</BUTTON> 
<BUTTON class=button onClick="Run('Calc')">计算器</BUTTON> 
<BUTTON class=button onClick="Run('cmd')">CMD</BUTTON> 
<BUTTON class=button onClick="Run('Regedit')">注册表</BUTTON> 
<BUTTON class=button onClick="Run('Msconfig')">启动选项</BUTTON> 
<BUTTON class=button onClick="Run('wmplayer')">WMPlayer</BUTTON> 
<BUTTON class=button onClick="Run('msimn')">OE</BUTTON> 
<BUTTON class=button onClick="Run('IEXPLORE')">IE</BUTTON><BR><BR>
<BUTTON class=button onClick="Run('...')">我的电脑</BUTTON> 
<BUTTON class=button onClick="Run('file:///::{450D8FBA-AD25-11D0-98A8-0800361B1103}')">我的文档</BUTTON> 
<BUTTON class=button onClick="Run('file:///::{208D2C60-3AEA-1069-A2D7-08002B30309D}')">网上邻居</BUTTON> 
<BUTTON class=button onClick="Run('file:///::{645FF040-5081-101B-9F08-00AA002F954E}')">回收站</BUTTON> 
<BUTTON class=button onClick="Run('file:///::{20D04FE0-3AEA-1069-A2D8-08002B30309D}/::{21EC2020-3AEA-1069-A2DD-08002B30309D}')">控制面板</BUTTON> 
<BUTTON class=button onClick="Run('EXPLORER')">资源管理器</BUTTON> 
<BUTTON class=button onClick="Run('%windir%')">系统目录</BUTTON> 
<BUTTON class=button onClick="Run('C:/DOCUME~1/ADMINI~1/LOCALS~1/TEMPOR~1')">缓存文件</BUTTON> 
<BUTTON class=button onClick="Run('%temp%')">临时文件</BUTTON>
</p> 

?

  相关解决方案