VB script is the script(code or language of visual basic program).using vbscript we can do the user commands, we can communicate between user(client) and server i.e. instruction, validating, making decision etcsuch dynamic task are performed by Vbscript.
Vb script is the event driven program ,it is followed on each event.
Programming language:-
a.The language communicate between the media.
b.The programming language is that which can communicate between the machine and the user.
c.The programming language is used to create the program(software).
There are two types of programming language:-
1.High level.
2.Low level
1.High level:-
This is the machine independent language. That means the program made by high level language is not directly understood by computer but through the interpreter and assembler.
High level language are :-Java,basic etc.
Basic :-
Basic language is that which are used in qbasic,microsoft access and visual basic ,using these language ,the programme are made.
2.Low level :-
This language is used to create the machine level program. That means the machine level program is directly understood by program, is in the form of binary and uncommon to common persons.
Controls and objects:-
The Buttons, textbox, options button (radio button), dropdown list box, list box etc are the object (controls).They have the physical structure. They may have the properties and events. Objects can function on the event.
Controls:
a.button
b.text
c.check box
d.radio button
e.submit button
f.reset button
g.text area
h.password field
controls and properties:-
Properties are theirs attributes from the properties we can recognize the controls.
controlsproperties:-
Button-type, name, values
Reset button-type, values
Text -type, name, size, max length
Check box-type, name
Radio button-type, name, value
Submit button-type, value
Text area-name, rows, cols
Events produced by controls:-
The event is the action done by controls or the controls can give some output on theirs’ events.
The some events used in webpage are given below:-
I.onclick
II.ondoubleclick
III.onload
IV.onkeydown
V.onmouseover
Procedure:-
The block or working area or events’ instructing action block is the procedure. The procedure are two kinds:-
1.sub procedure:-
The sub procedure is that block which is used for common use.
Sub procedure’s block:-
Syntax:-
Sub procedurename()
[statement]
end sub
2.event procedure
The event procedure is made on the response of event that is used privately within the one block.
Syntax:-
Private sub control_onevent()
[statement]
End sub
Variable and variant:-
Variable are some alphabetical(string)character which are changeable during program execution.they are thought as the memory device those can store the input instruction for the value store and execution.
Variant also can store the value but they are private and takes the unexpected memory.
Variable are assigned as below:-
- For the declare or assign Dim keyword is used
- particular name is given
- name is in the string
- data type should be fixed
variable are declared in the following level:-
1.private level
2.public level.
1.private level:-
Private sub b1_onclick()
Dim [variablename] as data type
End sub
Data types:-
There is used many kinds of datas in computer like text,image,picute,number,music,video and songs.According to the use of data ,there are following types of data types:-
Data type—-meaning
String-text or alphabetical characters and symbol aswell as number not for numeric calculation eg.a,b,c,1,2,#,% etc.It contains the memory 0 upto 255.
Integer-number for mathematical calculation eg.1,2,3 etc .It contains 0 to 32,768
Single-it accepts decimal and negative.It accepts millions of data.
Double-it also support decimal and negative .It has more than single memory.
Date and time-it is date and time containing data type.
Operator:-
Operators are the symbol or character for functioning particular actions.
There are following types of operators:-
- mathematical operators:-
- +-for addition.
- –for subtraction.
- *-for multiplications.
- /-for division.
- ^-for power calculation.
- Mod-for finding remainder.
- Comparison operators:-
- =-for showing equal to
- <>-not equal to
- >-to say greater than for compare.
- <-to say smaller than for compare.
- >=-to say greater than and equal to for compare.
- to say smaller than and equal to for compare.
3.Logical operator:-
·And-combine two true options.
·Or-select the true or false from two options.
Functions:-
Functionsare the set of action that can perform distinct task.
- string functions:-
·Len(string)-finds out length
·mid(string, start as long, length)-string from mid
·left(string, start as long)-strings from left
·right(string, start as long)-string from right
- Date and time:-
·Date-finds the current date
·Now-all date and time
·Time-current time
·Month(date)-month only
·Hour(time)-hour from the current time
·Second(time)-second from the current time.
3.mathamaical functions:-
ØCint –change string into integer.
ØVal-change string into integer.
ØSqr-finds the square.
4.input and output function:-
There are two input and output functions they are called inputbox and msgbox.
Inputbox-
Execute the input box where the user can input the value.
Syntax:
Inputbox “prompt”,”heading”
Msgbox-
The information can be given or executed from the msgbox.
Syntax:-
Msgbox “prompt”,buttonvalue,”heading”
Button value and meaning:-
|
Value |
Description |
|
0 |
OK button only (default) |
|
1 |
OK and Cancel buttons |
|
2 |
Abort, Retry, and Ignore buttons |
|
3 |
Yes, No, and Cancel buttons |
|
4 |
Yes and No buttons |
|
16 |
Critical message |
|
32 |
Warning query |
|
48 |
Warning message |
|
64 |
Information message |
|
16384 |
Adds Help button to the message box |
|
65536 |
Specifies the message box window as the foreground window |
|
524288 |
Text is right aligned |
Alert:-
It is also used to display the information.
Syntax:-
Alert “message”
Openingand closing window:-
Opening window:-
Syntax:-
Window. open “page name.html”
Closing window:-
Syntax:-
Window. close “page name.html”
Writing in window:-
Syntax:-
Document. write “text”
Programe flow control :-
Program ‘s flow is controlled using operator and function with the some construct.
Decission making:-
If—construct:-
Using if construct we can get the distinct decision with the operator.
Syntax:-
For single condition:-
If [condition] then
[true output]
else
[false output]
end if
For multiple condition :-
We use elseif for multiple condition instead of if constructs.
syntax:-
if [condition] then
[true output]
elseif [condition] then
[true output]
elseif [condition] then
else
[true output]
end if
Looping construct:-
Looping is used for the shortening the large coding .It works repeatedly until the given condition is satisfied.
There are different types of looping construct .
1.For……next.
2.Do while….loop
3.while ……wend.
For…..next
Syntax:-
For [control variable]=[initial value] to [final value]
[executionand calculation statement]
next
Using visual basic script within html
You can write down the vbscript in notepad or in Frontpage’s codes.
Syntax:-

