HTA 文件中的 JavaScript

发布于 2024-09-07 15:31:04 字数 705 浏览 3 评论 0原文

每次当我尝试使用 vbscript 在 hta 文件中添加 javascript 时,当我单击“提交”按钮时,都会出现一条错误消息:

object doesn't support this property or method

我尝试这个

<script type="text/javascript" src=""></script>

和这个

    <script type="text/javascript">
       ...code
    </script>

有谁知道这个问题吗?

//编辑:我有问题,我忘记了 VBScript:调用 vbscript 子程序 谢谢!!

<input type="submit" value=" Submit " onclick="Submit" style="margin-left:100px;">

这是正确的:

<input type="submit" value=" Submit " onclick="VBScript:Submit" style="margin-left:100px;">

everytime when i try to add javascript in a hta file with vbscript it comes an error message when i click the submit button:

object doesn't support this property or method

I try this

<script type="text/javascript" src=""></script>

and this

    <script type="text/javascript">
       ...code
    </script>

Is there anyone who know the problem?

//EDIT: I have the problem, i forgot a VBScript: to call the vbscript sub
THANKS!!

<input type="submit" value=" Submit " onclick="Submit" style="margin-left:100px;">

This is the right one:

<input type="submit" value=" Submit " onclick="VBScript:Submit" style="margin-left:100px;">

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜吻♂芭芘 2024-09-14 15:31:04

很难确定,因为您的问题不完整,但是您可能将 Javascript 代码放入 VBScripts 标记中。

'' 就像左括号,而 '' 就像右括号。 VBScript 标签仅适用于 VBScript,Javascript 标签仅适用于 Javascript。

将以下内容放入 SILLY.HTA 中并尝试一下:

<html>
<head>
  <title>My Silly Application</title>
  <HTA:APPLICATION>
</head>
<body>
<script language="vbscript">
document.title = "NOT SO SILLY NOW"
self.ResizeTo 200,200

Sub Window_Onload
self.MoveTo (screen.availWidth - (document.body.clientWidth + 40)),10
End Sub
</script>

<script language="javascript">
window.resizeTo(640, 480);
document.write("<h1>Something from Javascript</h1>");
</script>
</body>

It's hard to be sure because your question is not complete, however it is likely that you are putting your Javascript code inside VBScripts <script></script> tags.

'' is like an opening bracket, and '' is like a closing bracket. The VBScript tags are only for VBScript and the Javascript ones are only for Javascript.

Put the following in SILLY.HTA and try it out:

<html>
<head>
  <title>My Silly Application</title>
  <HTA:APPLICATION>
</head>
<body>
<script language="vbscript">
document.title = "NOT SO SILLY NOW"
self.ResizeTo 200,200

Sub Window_Onload
self.MoveTo (screen.availWidth - (document.body.clientWidth + 40)),10
End Sub
</script>

<script language="javascript">
window.resizeTo(640, 480);
document.write("<h1>Something from Javascript</h1>");
</script>
</body>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文