VB usage



HTML The <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.

In the <script> tag, please use the type attribute to define the script language "text/vbscript":

<html>
<body>
<script type="text/vbscript">
...
</script>
</body>
</html>

IE will interpret and execute the VBScript code between <script> and </script>.

lamp.jpgVBScript should not be used as a client-side scripting language!
Here, we use VBScript only for IE for learning.


VBScript Output

When VBScript is used in an ASP page on a Web server, the statement response.write( ) produces output.

When we use Internet Explorer to test VBScript, we use document.write() to produce the output:

Example

实例(仅适用于 Internet Explorer)
<html>
<body>
<script type="text/vbscript">
document.write("Hello World!")
</script>
</body>
</html>

Run instance»

Click the "Run instance" button to view the online instance

In the above instance, the browser outputs "Hello World!" to HTML page.