VBScript & JAVAScript Programming Notes
VBScript & JAVAScript Programming Notes
VBScript stands for Visual Basic Scripting that forms a subset of Visual Basic for Applications
(VBA). VBA is a product of Microsoft which is included NOT only in other Microsoft products such
as MS Project and MS Office but also in Third Party tools such as AUTO CAD.
Features of VBScript
VBScript is a lightweight scripting language, which has a lightning fast
interpreter.
Successful execution of VBScript can happen only if it is executed in Host Environment such as
Internet Explorer (IE), Internet Information Services (IIS) and Windows Scripting Host (WSH)
1)
<script language="vbscript" type="text/vbscript">
var1 = 10
var2 = 20
Sum = var1 + var2
document.write("The Sum of two numbers"&_
"var1 and var2 is " & Sum)
</script>
2)
<html>
<head>
<script type="text/Vbscript">
<!--
Function sayHello()
Msgbox("Hello World")
End Function
//-->
</script>
</head>
<body>
<input type="button" onclick="sayHello()" value="Say Hello" />
</body>
</html>
3)
<html>
<body>
<script language="vbscript" type="text/vbscript">
Dim Var1
Dim Var2
Call add()
Function add()
Var1 = 10
Var2 = 15
Dim Var3
Var3 = Var1+Var2
Msgbox Var3 'Displays 25, the sum of two values.
End Function
</script>
</body>
</html>
4)
<html>
<body>
<script language="vbscript" type="text/vbscript">
Dim intRadius
intRadius = 20
const pi=3.14
Area = pi*intRadius*intRadius
Msgbox Area
</script>
</body>
</html>
5)
<html>
<body>
<script language="vbscript" type="text/vbscript">
6)
<html>
<body>
Dim b : b = 10
Dim c
c = a+b
Document.write ("<br></br>")
c = a-b
c = b/a
c = b MOD a
c = b^a
</script>
</body>
7)
PrimeNumberLimit = Inputbox("Enter the range to check Prime no : ")
Next
Msgbox PrimeNumberList
'Displaying the result
8)
MyStr=Ucase(inputbox("Enter the String:"))
RevStr=strreverse(MyStr)
if strcomp(MyStr,RevStr)=0 then
msgbox "It is a Palindrome"
else
msgbox "It is not a Palindrome"
end if
9)