0

不知道是否有人问过这个问题,(我找不到)......

我做了一个简单的谷歌搜索 HTA 文件......

它很好用,真的没有问题,但我希望在我按下回车后文本消失?

我在搜索后尝试了 BasicTextBox.Value = "" ...但是除了最后一个字母之外,这无论如何都需要..

我希望我有道理,有人可以帮助我吗?

<html>
<head>
<title>Search Google</title>

<HTA:APPLICATION 
ID="objHTAHelpomatic"
border="thin"
borderStyle="normal"
caption="yes"
maximizeButton="no"
minimizeButton="no"
showInTaskbar="yes"
windowState="normal"
innerBorder="no"
navigable="no"
scroll="no"
scrollFlat="no"
sysMenu="yes"
icon="htaicon.ico"
>
</head>

<SCRIPT Language="VBScript">

 Sub Window_OnLoad
 window.resizeTo 100, 100
  End Sub


sub checkEnter
With document.parentWindow.event
if .keycode = 13 then
Const NORMAL_WINDOW = 1
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "https://www.google.com.au/search?q=" & BasicTextBox.Value
Else
.cancelbubble = false
.returnvalue = true
End if
End With

  call removetext

End sub 

sub removetext
   BasicTextBox.Value = ""
end sub

</SCRIPT>
<body bgColor="gray" STYLE="font:8pt arial; color:white">

Search Google
<input type="text" onKeydown=checkEnter name="BasicTextBox" size="10">

</body>
</html>
4

1 回答 1

0

只需removetext致电checkEnter

sub checkEnter
    Const NORMAL_WINDOW = 1
    With document.parentWindow.event
        if .keycode = 13 then
            Set objShell = CreateObject("Shell.Application")
            objShell.ShellExecute "https://www.google.com.au/search?q=" & BasicTextBox.Value
            call removetext
        End if
End With
于 2012-11-07T10:29:07.450 回答