如何在 HTA window 中输出结果而不是弹出消息框?
How to output result inside HTA window instead of a pop up message box?
我在 HTA 文件中有一个按钮,它会搜索某些字符串然后输出结果。( @Ansgar Wiechers) 我想在这个 HTA window 的一侧输出结果弹出一个消息框。结果将填空 "YOU ARE IN _____ MODE"
我该怎么做?
<html>
<head>
<title></title>
<HTA:APPLICATION
APPLICATIONNAME=""
ID=""
VERSION="1.0"/>
</head>
<script language="VBScript">
Sub RUNCURRENTMODE
Set xml = CreateObject("Msxml2.DOMDocument.6.0")
xml.async = False
xml.load "C:\aaa\settings.xml"
If xml.ParseError Then
MsgBox xml.ParseError.Reason
self.Close() 'or perhaps "Exit Sub"
End If
For Each n In xml.SelectNodes("//CSVName")
Select Case n.Attributes.GetNamedItem("Value").Text
Case "standard.csv" : MsgBox "This is standard."
Case "non-standard.csv" : MsgBox "This is non-standard."
Case Else : MsgBox "Unexpected value."
End Select
Next
End Sub
</script>
<body bgcolor="buttonface">
<center>
<p><font face="verdana" color="red">YOU ARE CURRENTLY IN STANDARD CSV MODE</font></p>
<input id=runbutton class="button" type="button" value="CURRENT MODE" name="db_button" onClick="RUCURRENTMODE" style="width: 170px"><p>
</center>
</body>
</html>
通常您会将带有 ID 的元素放入 HTA 的 <body>
部分,例如段落。或跨度,因为您只想更新文本的一部分:
<body>
<p>You are in <span id="FOO"></span> mode</p>
</body>
并在您的函数中更改具有该 ID 的元素的值:
Select Case n.Attributes.GetNamedItem("Value").Text
Case "standard.csv" : FOO.innerText = "standard."
Case "non-standard.csv" : FOO.innerText = "non-standard."
Case Else : MsgBox "Unexpected value."
End Select
我在 HTA 文件中有一个按钮,它会搜索某些字符串然后输出结果。(
我该怎么做?
<html>
<head>
<title></title>
<HTA:APPLICATION
APPLICATIONNAME=""
ID=""
VERSION="1.0"/>
</head>
<script language="VBScript">
Sub RUNCURRENTMODE
Set xml = CreateObject("Msxml2.DOMDocument.6.0")
xml.async = False
xml.load "C:\aaa\settings.xml"
If xml.ParseError Then
MsgBox xml.ParseError.Reason
self.Close() 'or perhaps "Exit Sub"
End If
For Each n In xml.SelectNodes("//CSVName")
Select Case n.Attributes.GetNamedItem("Value").Text
Case "standard.csv" : MsgBox "This is standard."
Case "non-standard.csv" : MsgBox "This is non-standard."
Case Else : MsgBox "Unexpected value."
End Select
Next
End Sub
</script>
<body bgcolor="buttonface">
<center>
<p><font face="verdana" color="red">YOU ARE CURRENTLY IN STANDARD CSV MODE</font></p>
<input id=runbutton class="button" type="button" value="CURRENT MODE" name="db_button" onClick="RUCURRENTMODE" style="width: 170px"><p>
</center>
</body>
</html>
通常您会将带有 ID 的元素放入 HTA 的 <body>
部分,例如段落。或跨度,因为您只想更新文本的一部分:
<body>
<p>You are in <span id="FOO"></span> mode</p>
</body>
并在您的函数中更改具有该 ID 的元素的值:
Select Case n.Attributes.GetNamedItem("Value").Text
Case "standard.csv" : FOO.innerText = "standard."
Case "non-standard.csv" : FOO.innerText = "non-standard."
Case Else : MsgBox "Unexpected value."
End Select