微软 VB 编译错误
Microsoft VB Compilation Error
我是 vbscripting 的初学者,作为初学者尝试执行以下代码。但我不断收到编译错误 [请参阅下面的错误消息]。我不确定,因为我没有在代码中看到任何错误。另外,我确保我输入了所有文本,而不是从网络上复制粘贴。请提出建议。
下面是代码
<html>
<body>
<script language = "vbscript" type = "text/vbscript">
<document.write("Hello World!")
</script>
</body>
</html>
错误信息:
Script: C:\VB Script- Learning\Programmes.vbs
Line: 1
Char: 1
Error: Expected Statement
Code: 800A0400
Source: Microsoft VBScript compilation error
谢谢!
删除
中的“<”(and the ())
<document.write("Hello World!")
得到
document.write "Hello World!"
您的文件内容 HTML 带有一个 VBScript 脚本块,但您显然是想 运行 它作为一个独立的 VBScript (.vbs
)。那行不通的。将文件另存为 .htm
并使用 Internet Explorer 打开它(如果您有 Internet Explorer 11,请确保添加 header <meta http-equiv="x-ua-compatible" content="IE=9">
):
<html>
<head>
<meta http-equiv="x-ua-compatible" content="IE=9">
</head>
<body>
<script language="VBScript" type="text/vbscript">
document.write "Hello World!"
</script>
</body>
</html>
或者删除所有 HTML 并用 WScript.Echo
替换 document.write
如果你想 运行 它作为 .vbs
文件 wscript.exe
或 cscript.exe
:
WScript.Echo "Hello World!"
我是 vbscripting 的初学者,作为初学者尝试执行以下代码。但我不断收到编译错误 [请参阅下面的错误消息]。我不确定,因为我没有在代码中看到任何错误。另外,我确保我输入了所有文本,而不是从网络上复制粘贴。请提出建议。
下面是代码
<html>
<body>
<script language = "vbscript" type = "text/vbscript">
<document.write("Hello World!")
</script>
</body>
</html>
错误信息:
Script: C:\VB Script- Learning\Programmes.vbs
Line: 1
Char: 1
Error: Expected Statement
Code: 800A0400
Source: Microsoft VBScript compilation error
谢谢!
删除
中的“<”(and the ())<document.write("Hello World!")
得到
document.write "Hello World!"
您的文件内容 HTML 带有一个 VBScript 脚本块,但您显然是想 运行 它作为一个独立的 VBScript (.vbs
)。那行不通的。将文件另存为 .htm
并使用 Internet Explorer 打开它(如果您有 Internet Explorer 11,请确保添加 header <meta http-equiv="x-ua-compatible" content="IE=9">
):
<html>
<head>
<meta http-equiv="x-ua-compatible" content="IE=9">
</head>
<body>
<script language="VBScript" type="text/vbscript">
document.write "Hello World!"
</script>
</body>
</html>
或者删除所有 HTML 并用 WScript.Echo
替换 document.write
如果你想 运行 它作为 .vbs
文件 wscript.exe
或 cscript.exe
:
WScript.Echo "Hello World!"