2010-03-24 39 views
0

我需要在一次單擊事件中調用兩個函數。而且這些函數也應該順序執行。我試過<button onclick="copy();zip();"> click me </button>。但它不起作用。它沒有調用任何函數。單擊事件在VBScript中順序調用兩個函數

下面是完整的代碼:

<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

寫它調用copy然後zip單一的功能。連線到onclick事件。

+0

功能兩者()調用 複印件()調用 拉鍊() 端功能 只調用複製() – sushant 2010-03-24 09:56:55

+0

u能告訴我在寫錯誤了嗎? – sushant 2010-03-24 10:03:33

+0

您確定copy()不在某處出錯嗎? – 2010-03-24 10:31:27

相關問題