VBScript Usage
The HTML <script> tag is used to insert VBScript into HTML.
VBScript in HTML
To insert VBScript into HTML, the script must be written between the standard <script> and </script> tags.
Inside the <script> tag, use the type attribute to define the scripting language "text/vbscript":
<html>
<body>
<script type="text/vbscript">
...
</script>
</body>
</html>
<body>
<script type="text/vbscript">
...
</script>
</body>
</html>
IE will interpret and execute the VBScript code between <script> and </script>.
| VBScript should not be used as a client-side scripting language! Here, we use VBScript, which only works in IE, for learning. |
VBScript Output
When VBScript is used in ASP pages on a web server, the statementresponse.write()produces output.
When we use Internet Explorer to test VBScript, we usedocument.write()to produce output:
Example (Internet Explorer only)
<html>
<body>
<script type="text/vbscript">
document.write("Hello World!")
</script>
</body>
</html>
<body>
<script type="text/vbscript">
document.write("Hello World!")
</script>
</body>
</html>
Try it yourself »
In the example above, the browser outputs "Hello World!" to the HTML page.
Other Extensions