www.pickatutorial.com Computer Tutorials
Top eBooks: C/C++ | C# | Android | Mathematics | Database | Cloud | Graphics | Networking | Oracle | Hardware | AI
Top Tutorials: C/C++ | C#.NET | PHP MySQL | Java | Java Script | jQuery | HTML | xHTML | HTML5 | VB Script| CSS
Lessons First VBScript Code Bookmark and Share
Tutorial Home
Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
Lesson 6
Lesson 7
Lesson 8
Lesson 9
Lesson 10
Lesson 11
Lesson 12
Lesson 13
Lesson 14
In this lesson we will write our fist VBScript code and run the same in Intenet Explorer.

Almost every programming language book starts with a hello world program that output, usually on the screen, the string "Hello World. We will do the same in this lesson.

We write the VBScript code in an HTML file and save the same with .htm or .html extension. For the following Hello World example; open the text editor of your choice, type the following and save the file with .htm or .html extension:

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

Now open the above in Internet Explorer. The above code would output the following in Internet Explorer:

Hello World!

The above code works as follows:

  • The <script> tags are actually HTML. They tell the browser to expect and process the enclosed text as a script. We specify the language, in this case text/vbscript, using the type attribute.
  • document.write("Hello World!") outputs the text "Hello World!". We use the same syntax to write text to a web page in our VBScript code. This, actually, is a method of the document object. Mehods will be discussed in one of the coming lessons.
  • Note that we have enclosed the Hello World! text in quotes. This is how we deal with strings / text in our VBScript code. More on string later. Keep reading...

Next >>> Lesson No. 3: VBScript Basics






Home - Advertise - Contact - Disclaimer - About Us
© Since 2006 pickatutorial.com -- All Rights Reserved.