从 hta 打开 .chm

Open a .chm from a hta

我有一个 HTA,我已经为其制作了一个 .chm 帮助文件。我想要一个 JavaScript 或一个 VBScript 函数来从 HTA 打开一个 .chm 文件,以便能够制作这样的帮助按钮:

<button onclick="//I don't know what to put here">Help</button>

我该怎么做?

在带有 HTA 的 vbscript 中,我们可以这样做:

<html>
<Title>How to open VBSCRIP5.CHM</Title>
<head>
<HTA:APPLICATION
ICON="cmd.exe"
APPLICATIONNAME = "How to open VBSCRIP5.CHM"
BORDER="dialog"
BORDERSTYLE="complex"
>
<style>
body{
background-color: DarkOrange;
}
</style>
</head>
<script type="text/Vbscript">
Sub OpenCHMFile()
Dim CHMFile
CHMFile = "C:\Program Files\Microsoft Office\Office1236\VBSCRIP5.CHM"
Call Launch(CHMFile)
End Sub
'********************************************
Sub Launch(MyProgram)
Dim ws,Result
Set ws = CreateObject("wscript.Shell")
Result = ws.run(DblQuote(MyProgram),1,False)
End Sub
'********************************************
Function DblQuote(Str)
    DblQuote = Chr(34) & Str & Chr(34)
End Function
'********************************************
</script>
<body text="white">
<center>
<input type="button" onClick="OpenCHMFile()" value="Open the help file">
</center>
</body>
</html>