VBScript Usage

Example

Using VBScript to write text
How to write text on the page.
Using HTML tags to format text
How to work together with HTML tags and VBScript.

How to place VBScript in an HTML document

<html>
<head>
</head>
<body>
<script type="text/vbscript">
document.write("Hello from VBScript!")
</script>
</body>
</html>

The above code generates the following output:

Hello from VBScript!

To insert a script into an HTML document, use the <script> tag. Use the type attribute to define the script language.

<script type="text/vbscript">

Then enter VBScript: The command to write text on the page is document.write:

document.write("Hello from VBScript!")

The script ends here:

</script>

How to deal with old browsers

Oude browsers die scripts niet ondersteunen, tonen scripts als inhoud van de pagina. Om dit te voorkomen, kunnen we HTML-commentaartags gebruiken:

<script type="text/vbscript">
<!--
  Voer hier een statement in
-->
</script>