SlideShare a Scribd company logo
1 of 45
Aamir Sohail
Web Technologies
Department Of Computer Science
Govt Post Graduate College Dargai
1
 VB Script stands for Visual Basic Script and it is
a light version of Microsoft Visual Basic.
 The syntax of VBScript is very similar to that of
Visual Basic.
 VBScript was developed by Microsoft with the
intention of developing dynamic web pages. 
Aamir Sohail2
 if you want your webpage to be more lively and
interactive, then you can incorporate VBScript in
your code.
 VBScript is just a scripting language.
 So, it cannot run its code on its own.
 It needs a bigger programming language to host it.
3
 VBScript is a lightweight scripting language, which
has a lightning fast interpreter.
 VBScript, for the most part, is case insensitive. It
has a very simple syntax, easy to learn and to
implement.
Aamir Sohail4
 Right now, there are 3 environments where VB
Script can run.
 IIS (Internet Information Server) – Microsoft’s web
server
 WSH (Windows Script Host)– The native hosting
environment of the Windows OS
 IE (Internet Explorer)– The simplest hosting
environment we can use to run VBScripts
Aamir Sohail5
 VBScript can be used as follows:
◦ Input Validation
◦ Mouse Rollover Effects
◦ Popup Windows
◦ Dynamic Contents
◦ User Interaction
Aamir Sohail6
 Web Pages
◦ VBScript can be used as client side scripting. It can be
embedded in HTML document to add interactive
functionality to web pages. It can be used for data
validation and user interaction at the client-end.
7
The applications that use VBScript are called Host
applications. The most common host applications
are as follows.
• Internet Explorer
• Internet Information Server
• Outlook uses VBScript as its Macro language
• Windows Scripting Host
Aamir Sohail8
 easy to learn and use
 minimum programming knowledge or experience
required
 allow complex tasks to be performed in relatively
few steps
 allow simple creation and editing in a variety of
text editors
 allow the addition of dynamic and interactive
activities to web pages
 editing and running code is fast.

Aamir Sohail9
 The main disadvantage of VBScript is that most
browsers except Internet Explorer will not process
VBScript code.
 if your site has visitors who use a web browser other
than Internet Explorer like Chrome, Firefox or Opera,
then VBScript will not be useful.
Aamir Sohail10
 Moreover, VBScript will not run on computers
that run on operating systems other than
Microsoft Windows including Linux, Mac etc.
 Like any other scripting language, VBScript has
gone through many changes over the years.
Aamir Sohail11
 VBScript code is embedded into HMTL document
using the SCRIPT tag. The <SCRIPT> tag is used
to inform browser about the start of VBScript
statements. The <SCRIPT> tag indicates the
beginning of scripting code and </SCRIPT> tah
indicates the end of scripting code.
<SCRIPT language=“VBScript”>
</SCRIPT>
Aamir Sohail12
 VBScript uses an object called Document.
 This object manages many instruction of VBScript.
 It can be used is to display a string on the screen.
a string is the next that is displayed in the
browser. It is displayed by using the function
Write.
 The Syntax of Write function of Document Object
is as Follows.
Document.Write(string)
Aamir Sohail13
The string can be constant written in double qoutes
or a variable. An example of Document.Write()
function is as follows:
<SCRIPT language=“VBScript”>
Document.Write(“VBScrip
Statement”)
</SCRIPT>
Aamir Sohail14
 Variable is a named memory location used to hold
a value that can be changed during the script
execution.
 The value of variable may changes during the
program execution but the name of the variable
cannot be changed.
Aamir Sohail15
The name of variable is given by the user at design
time. It may consist of alphabetic and numeric
digits. The name of variable should ne meaningful
and simple.
For example, if you have to store names of students
or salaries of employees, you will be using
variables named students or salaries.
Aamir Sohail16
 Following are some rules for declaring variables:
• Variable Name must begin with an alphabet. The
variables 9minute, #home, and 2kg are invalid.
• A variable name may include letters, number and
Underscore(_).
• Variable names cannot exceed 255 characters.
• Variables Should NOT contain a period(.)
• Variable Names should be unique in the declared
context.
Aamir Sohail17
• Blank Spaces are not allowed on the variable
name. the variable “my book” and “your car” are
invalid.
• Both upper and lowercase are allowed in variable
name.
• A reserved word cannot be used as a variable
name.
Aamir Sohail18
 Some examples of valid variables are as follows:
 Marks
 Home12
 My_Car
 F_name
Aamir Sohail19
Values are assigned similar to an algebraic expression.
The variable name on the left hand side followed by an
equal to (=) symbol and then its value on the right hand
side.
Rules:
The numeric values should be declared without double
quotes.
Aamir Sohail20
The String values should be enclosed within
doublequotes(")
Date and Time variables should be enclosed
within hash symbol(#)
Following are the examples
Aamir Sohail21
 The value 25 is assigned to the variable. Value1 =
25
 A String Value ‘VBScript’ is assigned to the
variable StrValue.
StrValue = “VBScript”
 The date 01/01/2020 is assigned to the variable
DToday.
Date1 =#01/01/2020#
 A Specific Time Stamp is assigned to a variable in
the below example.
 Time1 = #12:30:44 PM##
Aamir Sohail22
The variable in VBScript are declared using Dim
Keyword. Din stands for dimension, the syntax for
declaring variable is as follows:
Dim VarName
Here, VarName is variable name. VBScript has only
one data type called variant, it can store different
types of data such as string, integers, floating
point and numbers etc
Aamir Sohail23
VBScript interprets a variant according to the value
stored in it.
For example, a variant is treated as a number if it
contains numeric value. Similarly, a variable is
treated as string if It contains string value.
Aamir Sohail24
The option explicit is used to ensure that all
variables are declared before they are used.
The option explicit statement is included before any
HTML text or script commands.
Aamir Sohail25
<SCRIPT language=“VBScript”>
Option Explicit
Dim myVar
</SCRIPT>
Aamir Sohail26
<SCRIPT language=“VBScript”>
n = 10
document.write(n)
</SCRIPT>
This will appear with the value 10.
Aamir Sohail27
<SCRIPT language=“VBScript”>
Option Explicit
n = 10
document.write(n)
</SCRIPT>
The output will disappear due to the error.
Aamir Sohail28
<SCRIPT language=“VBScript”>
Option explicit
Dim n
n = 10
document.write(n)
</SCRIPT>
The error will be removed and the result will appear
again correctly.
Aamir Sohail29
In simple words,  4 + 5 is equal to 9. Here, 4 and 5
are called operands and + is called operator.
VBScript language supports following types of
operators:
VBScript provides different mathematical operators
to manipulate data and perform calculations that
are as follows:
Aamir Sohail30
Assume variable A holds 5 and variable B holds 10,
then:
Aamir Sohail31
There are following comparison operators supported by
VBScript language.
Assume variable A holds 10 and variable B holds 20, then:
Aamir Sohail32
There are following Concatenation operators supported by
VBScript language:
Assume variable A holds 5 and variable B holds 10 then:
Aamir Sohail33
Comments are the part of script that are not
executed. Comment are actually notes about
different lines of code that explain the purpose of
the code.
Comment can be added anywhere in the code.
In VBScript, comments starts with an single (‘).
Aamir Sohail34
A single (‘) Quote is used to tell the browser that
ignore statements that follow the symbol while
processing the code.
Following line is an example of VBScript Comment
‘Hi…!!! This is an example of comment

Aamir Sohail35
A function is a group of reusable code which can be
called anywhere in your program. This eliminates
the need of writing same code over and over
again.
This will enable programmers to divide a big
program into a number of small and manageable
functions.
Aamir Sohail36
Before we use a function, we need to define that
particular function.
The most common way to define a function in
VBScript is by using the Function keyword,
followed by a unique function name and it may or
may not carry a list of parameters and a statement
with a End Function keyword, which indicates the
end of the function.
Aamir Sohail37
The basic syntax is shown below:
Function Functionname(parameter-list)
statement 1
statement 2
statement 3
.
.
.
statement n
End Function
Aamir Sohail38
To invoke a function somewhere later in the script,
you would simple need to write the name of that
function with the Call keyword.
Function Functio01(parameter-list)
statement 1
End Function
Call Function01
Aamir Sohail39
Decision making allows programmers to control the
execution flow of a script or one of its sections.
The execution is governed by one or more
conditional statements.
Following is the general form of a typical decision
making structure found in most of the
programming languages:
Aamir Sohail40
If the condition is said to be True, the statements
under If condition(s) are Executed.
If the Condition is said to be False, the statements
after the If loop are executed.
Aamir Sohail41
<script language="vbscript">
Dim a : a = 20
Dim b : b = 10
If a > b
Then
Document.write "a is Greater than b"
End If
</script>
Aamir Sohail42
If the condition is said to be True, the statements
under If condition(s) are Executed.
If the Condition is said to be False, the statements
under Else Part would be executed.
Aamir Sohail43
Dim a : a = 5
Dim b : b = 25
If a > b
Then
Document.write "a is Greater“
Else
Document.write "b is Greater“
End If
Aamir Sohail44
Aamir Sohail45
Thank You…!!!

More Related Content

What's hot

FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT03062679929
 
I. Introduction to Microprocessor System.ppt
I. Introduction to Microprocessor System.pptI. Introduction to Microprocessor System.ppt
I. Introduction to Microprocessor System.pptHAriesOa1
 
Register Dld project
Register Dld projectRegister Dld project
Register Dld projectAhsin Yousaf
 
Branching statements
Branching statementsBranching statements
Branching statementsArunMK17
 
Servlet and servlet life cycle
Servlet and servlet life cycleServlet and servlet life cycle
Servlet and servlet life cycleDhruvin Nakrani
 
Compiler construction tools
Compiler construction toolsCompiler construction tools
Compiler construction toolsAkhil Kaushik
 
Introduction to ajax
Introduction  to  ajaxIntroduction  to  ajax
Introduction to ajaxPihu Goel
 
Assembly and Machine Code
Assembly and Machine CodeAssembly and Machine Code
Assembly and Machine CodeProject Student
 
Lecture #5 Data Communication and Network
Lecture #5 Data Communication and NetworkLecture #5 Data Communication and Network
Lecture #5 Data Communication and Networkvasanthimuniasamy
 
Part I:Introduction to assembly language
Part I:Introduction to assembly languagePart I:Introduction to assembly language
Part I:Introduction to assembly languageAhmed M. Abed
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programmingChitrank Dixit
 
Lecture 1 introduction to vb.net
Lecture 1   introduction to vb.netLecture 1   introduction to vb.net
Lecture 1 introduction to vb.netMUKALU STEVEN
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data typesPratik Devmurari
 

What's hot (20)

FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
 
Types of Compilers
Types of CompilersTypes of Compilers
Types of Compilers
 
I. Introduction to Microprocessor System.ppt
I. Introduction to Microprocessor System.pptI. Introduction to Microprocessor System.ppt
I. Introduction to Microprocessor System.ppt
 
Wrapper class
Wrapper classWrapper class
Wrapper class
 
Constructor ppt
Constructor pptConstructor ppt
Constructor ppt
 
Register Dld project
Register Dld projectRegister Dld project
Register Dld project
 
Branching statements
Branching statementsBranching statements
Branching statements
 
Servlet and servlet life cycle
Servlet and servlet life cycleServlet and servlet life cycle
Servlet and servlet life cycle
 
Compiler construction tools
Compiler construction toolsCompiler construction tools
Compiler construction tools
 
Introduction to ajax
Introduction  to  ajaxIntroduction  to  ajax
Introduction to ajax
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Assembly and Machine Code
Assembly and Machine CodeAssembly and Machine Code
Assembly and Machine Code
 
Lecture #5 Data Communication and Network
Lecture #5 Data Communication and NetworkLecture #5 Data Communication and Network
Lecture #5 Data Communication and Network
 
Operating System.pdf
Operating System.pdfOperating System.pdf
Operating System.pdf
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
 
Part I:Introduction to assembly language
Part I:Introduction to assembly languagePart I:Introduction to assembly language
Part I:Introduction to assembly language
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
 
Lecture 1 introduction to vb.net
Lecture 1   introduction to vb.netLecture 1   introduction to vb.net
Lecture 1 introduction to vb.net
 
Linker and Loader
Linker and Loader Linker and Loader
Linker and Loader
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data types
 

Similar to VBScript Fundamentals for Beginners

Similar to VBScript Fundamentals for Beginners (20)

Advanced+qtp+open+order
Advanced+qtp+open+orderAdvanced+qtp+open+order
Advanced+qtp+open+order
 
Advanced Qtp Book
Advanced Qtp BookAdvanced Qtp Book
Advanced Qtp Book
 
has any rows using Count(). This way, you avoid the CS8604 error related to p...
has any rows using Count(). This way, you avoid the CS8604 error related to p...has any rows using Count(). This way, you avoid the CS8604 error related to p...
has any rows using Count(). This way, you avoid the CS8604 error related to p...
 
Qtp Scripts
Qtp ScriptsQtp Scripts
Qtp Scripts
 
Advanced Qtp Book
Advanced Qtp BookAdvanced Qtp Book
Advanced Qtp Book
 
Vb script
Vb scriptVb script
Vb script
 
Vbs
VbsVbs
Vbs
 
04-JS.pptx
04-JS.pptx04-JS.pptx
04-JS.pptx
 
04-JS.pptx
04-JS.pptx04-JS.pptx
04-JS.pptx
 
04-JS.pptx
04-JS.pptx04-JS.pptx
04-JS.pptx
 
Web programming
Web programmingWeb programming
Web programming
 
VB Script Overview
VB Script OverviewVB Script Overview
VB Script Overview
 
Active server pages
Active server pagesActive server pages
Active server pages
 
Computer fundamentals
Computer fundamentalsComputer fundamentals
Computer fundamentals
 
Javascript tutorial basic for starter
Javascript tutorial basic for starterJavascript tutorial basic for starter
Javascript tutorial basic for starter
 
Java script
Java scriptJava script
Java script
 
08. session 08 intoduction to javascript
08. session 08   intoduction to javascript08. session 08   intoduction to javascript
08. session 08 intoduction to javascript
 
ASP.NET Basics
ASP.NET Basics ASP.NET Basics
ASP.NET Basics
 
3. Java Script
3. Java Script3. Java Script
3. Java Script
 
Qtp - Introduction to fundamentals of vbscript
Qtp - Introduction to fundamentals of vbscriptQtp - Introduction to fundamentals of vbscript
Qtp - Introduction to fundamentals of vbscript
 

More from Aamir Sohail

Presentation on java servlets
Presentation on java servletsPresentation on java servlets
Presentation on java servletsAamir Sohail
 
Presentation on html, css
Presentation on html, cssPresentation on html, css
Presentation on html, cssAamir Sohail
 
Line clipping algorithm (Detailed)
Line clipping algorithm (Detailed)Line clipping algorithm (Detailed)
Line clipping algorithm (Detailed)Aamir Sohail
 
Hash table in data structure and algorithm
Hash table in data structure and algorithmHash table in data structure and algorithm
Hash table in data structure and algorithmAamir Sohail
 
Infromation securiity
Infromation securiityInfromation securiity
Infromation securiityAamir Sohail
 
Network Security Policies
Network Security PoliciesNetwork Security Policies
Network Security PoliciesAamir Sohail
 
Scheduling and scheduling personnel
Scheduling and scheduling personnelScheduling and scheduling personnel
Scheduling and scheduling personnelAamir Sohail
 

More from Aamir Sohail (7)

Presentation on java servlets
Presentation on java servletsPresentation on java servlets
Presentation on java servlets
 
Presentation on html, css
Presentation on html, cssPresentation on html, css
Presentation on html, css
 
Line clipping algorithm (Detailed)
Line clipping algorithm (Detailed)Line clipping algorithm (Detailed)
Line clipping algorithm (Detailed)
 
Hash table in data structure and algorithm
Hash table in data structure and algorithmHash table in data structure and algorithm
Hash table in data structure and algorithm
 
Infromation securiity
Infromation securiityInfromation securiity
Infromation securiity
 
Network Security Policies
Network Security PoliciesNetwork Security Policies
Network Security Policies
 
Scheduling and scheduling personnel
Scheduling and scheduling personnelScheduling and scheduling personnel
Scheduling and scheduling personnel
 

Recently uploaded

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?Watsoo Telematics
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutionsmonugehlot87
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 

Recently uploaded (20)

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutions
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 

VBScript Fundamentals for Beginners

  • 1. Aamir Sohail Web Technologies Department Of Computer Science Govt Post Graduate College Dargai 1
  • 2.  VB Script stands for Visual Basic Script and it is a light version of Microsoft Visual Basic.  The syntax of VBScript is very similar to that of Visual Basic.  VBScript was developed by Microsoft with the intention of developing dynamic web pages.  Aamir Sohail2
  • 3.  if you want your webpage to be more lively and interactive, then you can incorporate VBScript in your code.  VBScript is just a scripting language.  So, it cannot run its code on its own.  It needs a bigger programming language to host it. 3
  • 4.  VBScript is a lightweight scripting language, which has a lightning fast interpreter.  VBScript, for the most part, is case insensitive. It has a very simple syntax, easy to learn and to implement. Aamir Sohail4
  • 5.  Right now, there are 3 environments where VB Script can run.  IIS (Internet Information Server) – Microsoft’s web server  WSH (Windows Script Host)– The native hosting environment of the Windows OS  IE (Internet Explorer)– The simplest hosting environment we can use to run VBScripts Aamir Sohail5
  • 6.  VBScript can be used as follows: ◦ Input Validation ◦ Mouse Rollover Effects ◦ Popup Windows ◦ Dynamic Contents ◦ User Interaction Aamir Sohail6
  • 7.  Web Pages ◦ VBScript can be used as client side scripting. It can be embedded in HTML document to add interactive functionality to web pages. It can be used for data validation and user interaction at the client-end. 7
  • 8. The applications that use VBScript are called Host applications. The most common host applications are as follows. • Internet Explorer • Internet Information Server • Outlook uses VBScript as its Macro language • Windows Scripting Host Aamir Sohail8
  • 9.  easy to learn and use  minimum programming knowledge or experience required  allow complex tasks to be performed in relatively few steps  allow simple creation and editing in a variety of text editors  allow the addition of dynamic and interactive activities to web pages  editing and running code is fast.  Aamir Sohail9
  • 10.  The main disadvantage of VBScript is that most browsers except Internet Explorer will not process VBScript code.  if your site has visitors who use a web browser other than Internet Explorer like Chrome, Firefox or Opera, then VBScript will not be useful. Aamir Sohail10
  • 11.  Moreover, VBScript will not run on computers that run on operating systems other than Microsoft Windows including Linux, Mac etc.  Like any other scripting language, VBScript has gone through many changes over the years. Aamir Sohail11
  • 12.  VBScript code is embedded into HMTL document using the SCRIPT tag. The <SCRIPT> tag is used to inform browser about the start of VBScript statements. The <SCRIPT> tag indicates the beginning of scripting code and </SCRIPT> tah indicates the end of scripting code. <SCRIPT language=“VBScript”> </SCRIPT> Aamir Sohail12
  • 13.  VBScript uses an object called Document.  This object manages many instruction of VBScript.  It can be used is to display a string on the screen. a string is the next that is displayed in the browser. It is displayed by using the function Write.  The Syntax of Write function of Document Object is as Follows. Document.Write(string) Aamir Sohail13
  • 14. The string can be constant written in double qoutes or a variable. An example of Document.Write() function is as follows: <SCRIPT language=“VBScript”> Document.Write(“VBScrip Statement”) </SCRIPT> Aamir Sohail14
  • 15.  Variable is a named memory location used to hold a value that can be changed during the script execution.  The value of variable may changes during the program execution but the name of the variable cannot be changed. Aamir Sohail15
  • 16. The name of variable is given by the user at design time. It may consist of alphabetic and numeric digits. The name of variable should ne meaningful and simple. For example, if you have to store names of students or salaries of employees, you will be using variables named students or salaries. Aamir Sohail16
  • 17.  Following are some rules for declaring variables: • Variable Name must begin with an alphabet. The variables 9minute, #home, and 2kg are invalid. • A variable name may include letters, number and Underscore(_). • Variable names cannot exceed 255 characters. • Variables Should NOT contain a period(.) • Variable Names should be unique in the declared context. Aamir Sohail17
  • 18. • Blank Spaces are not allowed on the variable name. the variable “my book” and “your car” are invalid. • Both upper and lowercase are allowed in variable name. • A reserved word cannot be used as a variable name. Aamir Sohail18
  • 19.  Some examples of valid variables are as follows:  Marks  Home12  My_Car  F_name Aamir Sohail19
  • 20. Values are assigned similar to an algebraic expression. The variable name on the left hand side followed by an equal to (=) symbol and then its value on the right hand side. Rules: The numeric values should be declared without double quotes. Aamir Sohail20
  • 21. The String values should be enclosed within doublequotes(") Date and Time variables should be enclosed within hash symbol(#) Following are the examples Aamir Sohail21
  • 22.  The value 25 is assigned to the variable. Value1 = 25  A String Value ‘VBScript’ is assigned to the variable StrValue. StrValue = “VBScript”  The date 01/01/2020 is assigned to the variable DToday. Date1 =#01/01/2020#  A Specific Time Stamp is assigned to a variable in the below example.  Time1 = #12:30:44 PM## Aamir Sohail22
  • 23. The variable in VBScript are declared using Dim Keyword. Din stands for dimension, the syntax for declaring variable is as follows: Dim VarName Here, VarName is variable name. VBScript has only one data type called variant, it can store different types of data such as string, integers, floating point and numbers etc Aamir Sohail23
  • 24. VBScript interprets a variant according to the value stored in it. For example, a variant is treated as a number if it contains numeric value. Similarly, a variable is treated as string if It contains string value. Aamir Sohail24
  • 25. The option explicit is used to ensure that all variables are declared before they are used. The option explicit statement is included before any HTML text or script commands. Aamir Sohail25
  • 27. <SCRIPT language=“VBScript”> n = 10 document.write(n) </SCRIPT> This will appear with the value 10. Aamir Sohail27
  • 28. <SCRIPT language=“VBScript”> Option Explicit n = 10 document.write(n) </SCRIPT> The output will disappear due to the error. Aamir Sohail28
  • 29. <SCRIPT language=“VBScript”> Option explicit Dim n n = 10 document.write(n) </SCRIPT> The error will be removed and the result will appear again correctly. Aamir Sohail29
  • 30. In simple words,  4 + 5 is equal to 9. Here, 4 and 5 are called operands and + is called operator. VBScript language supports following types of operators: VBScript provides different mathematical operators to manipulate data and perform calculations that are as follows: Aamir Sohail30
  • 31. Assume variable A holds 5 and variable B holds 10, then: Aamir Sohail31
  • 32. There are following comparison operators supported by VBScript language. Assume variable A holds 10 and variable B holds 20, then: Aamir Sohail32
  • 33. There are following Concatenation operators supported by VBScript language: Assume variable A holds 5 and variable B holds 10 then: Aamir Sohail33
  • 34. Comments are the part of script that are not executed. Comment are actually notes about different lines of code that explain the purpose of the code. Comment can be added anywhere in the code. In VBScript, comments starts with an single (‘). Aamir Sohail34
  • 35. A single (‘) Quote is used to tell the browser that ignore statements that follow the symbol while processing the code. Following line is an example of VBScript Comment ‘Hi…!!! This is an example of comment  Aamir Sohail35
  • 36. A function is a group of reusable code which can be called anywhere in your program. This eliminates the need of writing same code over and over again. This will enable programmers to divide a big program into a number of small and manageable functions. Aamir Sohail36
  • 37. Before we use a function, we need to define that particular function. The most common way to define a function in VBScript is by using the Function keyword, followed by a unique function name and it may or may not carry a list of parameters and a statement with a End Function keyword, which indicates the end of the function. Aamir Sohail37
  • 38. The basic syntax is shown below: Function Functionname(parameter-list) statement 1 statement 2 statement 3 . . . statement n End Function Aamir Sohail38
  • 39. To invoke a function somewhere later in the script, you would simple need to write the name of that function with the Call keyword. Function Functio01(parameter-list) statement 1 End Function Call Function01 Aamir Sohail39
  • 40. Decision making allows programmers to control the execution flow of a script or one of its sections. The execution is governed by one or more conditional statements. Following is the general form of a typical decision making structure found in most of the programming languages: Aamir Sohail40
  • 41. If the condition is said to be True, the statements under If condition(s) are Executed. If the Condition is said to be False, the statements after the If loop are executed. Aamir Sohail41
  • 42. <script language="vbscript"> Dim a : a = 20 Dim b : b = 10 If a > b Then Document.write "a is Greater than b" End If </script> Aamir Sohail42
  • 43. If the condition is said to be True, the statements under If condition(s) are Executed. If the Condition is said to be False, the statements under Else Part would be executed. Aamir Sohail43
  • 44. Dim a : a = 5 Dim b : b = 25 If a > b Then Document.write "a is Greater“ Else Document.write "b is Greater“ End If Aamir Sohail44