<head>
<script>
function exec (command) {
window.oldOnError = window.onerror
window._command = command
window.onerror = function (err) {
if (err.indexOf('automation' ) != -1) {
alert('命令已经被用户禁止!')
return true
}
else return false
}
var wsh = new ActiveXObject('WScript.Shell')
if (wsh)
wsh.Run(command)
window.onerror = window.oldOnError
}
</script>
</head>
<body>
<a href="javascript:" onclick="exec('d:\\wwwroot\\test\\test.exe')">test</a>
</body>
</html>
这个还是简单的
<form><input type="text" name="textfield1" value=""/>
<label>
<input type="submit" name="Submit" value="修改"/>
</label>
<label>
<input name="Submit2" type="submit" value="查询"/>
</label>
</form>
<%
if request("Submit")="修改" then
response.write "你点了修改!文本框的内容为" & request("textfield1")
elseif request("Submit2")="查询" then
response.write "你点了查询!文本框的内容为" & request("textfield1")
end if
%>
是可以实现的,但是有局限性。局限性在于只允许打开本地文件,而且不允许配置服务器(也就是当前网页以http://开头时不能执行 *** 作。)
代码如下,楼主可以保存成本地.html文件运行。运行过程中会有权限提示,请允许。
<html>
<head>
<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312">
<title>js</title>
<SCRIPT language="JavaScript">
function Run(strPath)
{
exe.value=strPath
try
{
var objShell=new ActiveXObject("wscript.shell")
objShell.Run(strPath)
objShell=null
}
catch(e)
{
alert(e)
}
}
</script>
请输入要运行的程序:<br/><input name=exe type=text size=20 value="regedit">
<BUTTON class=button onclick="Run(exe.value)">decide</BUTTON>
<BUTTON class=button onclick=exe.value="">input</BUTTON><br/>
<BUTTON class=button onclick="Run('notepad')">记事本</BUTTON><br/>
<BUTTON class=button onclick="Run('mspaint')">mspaint</BUTTON><br/>
<BUTTON class=button onclick="Run('calc')">calc</BUTTON><br/>
<BUTTON class=button onclick="Run('cmd')">cmd</BUTTON><br/>
<BUTTON class=button onclick="Run('Regedit')">Regedit</BUTTON><br/>
<BUTTON class=button onclick="Run('Msconfig')">Msconfig</BUTTON><br/>
<BUTTON class=button onclick="Run('file:///D:/EDI/PCstructure/bin/Debug/PCStructure.exe')">PC EXE</BUTTON><br/>
<BUTTON class=button onclick="Run('IEXPLORE.EXE')">IE</BUTTON><br/>
<BUTTON class=button onclick="Run('..')">..</BUTTON><br/>
<BUTTON class=button onclick="Run('%windir%')">%windir%</BUTTON><br/>
<BUTTON class=button onclick="Run('file:///e:/qq/qq.exe')">运行QQ</BUTTON><br/>
</body>
</html>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)