我需要在单击事件上调用两个函数。并且函数应该按顺序执行。我试过了<button onclick="copy();zip();"> click me </button>
。但它不起作用。它没有调用任何函数。
以下是完整的代码:
<html>
<head>
<script type="text/vbscript">
function copy()
Dim WshShell, oExec,g,h
h="D:\d"
g="xcopy " & h & " " & "D:\y\ /E"
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec(g)
Do While oExec.Status = 0
WScript.Sleep 100
Loop
WScript.Echo oExec.Status
end function
function zip()
Dim WshShel, oExe
Set WshShel = CreateObject("WScript.Shell")
Set oExe = WshShel.Exec("cmd /c cd D:\d & D: & winzip32.exe -min -a D:\a")
Do While oExe.Status = 0
WScript.Sleep 100
Loop
WScript.Echo oExe.Status
end function
</script>
</head>
<body>
<button onclick="copy();zip();"> click me </button>
</body>
</html>
答案 0 :(得分:0)
编写一个调用copy
然后调用zip
的函数。连接到onclick
事件。