Internet Technology and Web Design: Chapter: 10.2 Interactive Tools Topic: 10.2.3 VB Script
Internet Technology and Web Design: Chapter: 10.2 Interactive Tools Topic: 10.2.3 VB Script
Internet Technology and Web Design: Chapter: 10.2 Interactive Tools Topic: 10.2.3 VB Script
VB Script
• JavaScript's syntax is arguably less intuitive and more obtuse than that
of VB Script and tends to be less forgiving of simple “mistakes” such as
case sensitivity.
• VB Script was introduced by Microsoft way back in 1996 and the first
version was 1.0. The Current Stable version of VB Script is 5.8, which is
available as part of IE8 or Windows 7.
<html>
<body>
<script language=”vbscript” type=”text/vbscript”>
document.write(“Hello World!”)
</script>
</body>
</html>
Page | 8
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
Features of VB Script
• VB Script, for the most part, is case insensitive. It has a very simple
syntax, easy to learn and to implement.
• The VB Script usage areas are aplenty and not restricted to the below
list.
Page | 9
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
Microsoft Outlook Forms usually runs on VB Script; however, the
application level programming relies on VBA (Outlook 2000
onwards).
Disadvantages of VB Script
Page | 10
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
• To declare variable
Variables are declared using “dim” keyword. Since there is only one
fundamental data type, all the declared variables are variant by
default. Hence, a user need not mention the type of data during
declaration.
Dim Var
Page | 11
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
• The following example program for to declare variable and assign value
to it.
<!DOCtype html>
<html>
<body>
<%
Dim name
name=”Gupta”
Response.write(“Myname is: “ & name)
%>
</body>
</html>
VB Script Constants
Page | 12
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
VB Script – Loops
• There may be a situation when user needs to execute a block of code several
number of times.
• Programming languages provide various control structures that allow for more
complicated execution paths.
Page | 13
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
Page | 14
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
<!DOCTYPE html>
<html>
<body>
<%
For i = 0 to 5
response.write(“The number is “& I & “ <br>
“)
Next
%>
</body>
</html>
The number is 0
The number is 1
The number is 2
The number is 3
The number is 4
The number is 5
Page | 15