VBScript Usage

Example

Use VBScript to write text
How to write text on the page.
Use HTML tags to format text
How to协同 use 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 will generate 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!")

Script ends here:

</script>

How to deal with old browsers

Old browsers that do not support scripts will display scripts as part of the web page content. To avoid this, we can use HTML comment tags:

<script type="text/vbscript">
<!--
  Enter statement here
-->
</script>