Sunday 24 January 2021

VBScript Class - 11

  VBScript Class - 11 by S P SHARMA CLASSES (7048972696)


<html>

<body>

<script type="text/VBScript">

s1="Manmohan"

s2="n"

n1=instr(s1,s2)

document.write("n1=" & n1 & "<br/>")

n2=instr(n1+1,s1,s2)

document.write("n2=" & n2 & "<br/>")


nr1=instrrev(s1,s2)

document.write("nr1=" & nr1 & "<br/>")

nr2=instrrev(s1,s2,6)

document.write("nr2=" & nr2 & "<br/>")

L=left(s1,3)

document.write("Left 3=" & L & "<br/>")

R=Right(s1,5)

document.write("Right 5=" & R & "<br/>")

M1=mid(s1,3,4)

document.write("M1=" & m1 & "<br/>")

M2=mid(s1,1,3)

document.write("M2=" & m2 & "<br/>")

M3=mid(s1,4,5)

document.write("M3=" & m3 & "<br/>")


S3="Sachin Parashar Sharma"

fname=left(s3,6)

document.write("fname=" & fname & "<br/>")

mname=mid(s3,8,8)

document.write("mname=" & mname & "<br/>")

lname=right(s3,6)

document.write("lname=" & lname & "<br/>")


document.write("........................<br/><br/>")

'S4=inputbox("Enter Your Name")

S4="Sachin Parashar Sharma"

fname=left(s4,6)

document.write("fname=" & fname & "<br/>")

mname=mid(s4,8,8)

document.write("mname=" & mname & "<br/>")

lname=right(s4,6)

document.write("lname=" & lname & "<br/>")


document.write("........................<br/><br/>")


document.write("Lcase=" & lcase(s3) & "<br/>")

document.write("Ucase=" & ucase(s3) & "<br/>")

document.write("Len=" & len(s3) & "<br/>")

S4="         Hello         India        "

document.write("S4=" & s4 & "<br/>")

document.write("S4=" & ltrim(s4) & "<br/>")

document.write("S4=" & rtrim(s4) & "<br/>")

document.write("S4=" & trim(s4) & "<br/>")


document.write("S3=" & replace(s3,"Sharma","Verma") & "<br/>")

document.write("S3=" & S3 & "<br/>")


document.write( strcomp("ram","raj") & "<br/>")

document.write( strcomp("ram","ram") & "<br/>")

document.write( strcomp("raj","ram") & "<br/>")

document.write( string(5,"ram") & "<br/>")

document.write( string(50,"*") & "<br/>")

document.write( strreverse("Hello") & "<br/>")

document.write( strreverse("150.58") & "<br/>")

</script>

</body>

</html>

VBScript Class - 10

  VBScript Class - 10 by S P SHARMA CLASSES (7048972696)


<html>

<body>

<script type="text/VBScript">

dim x

x="Ram"

document.write("x=" & x & "<br/>")

dim y

'y='R'

y=8.5

document.write("y=" & y & "<br/>")

a=#2021/01/24#

document.write("a=" & a & "<br/>")


a=#01/24/2021#

document.write("a=" & a & "<br/>")


a=#20:18#

document.write("a=" & a & "<br/>")


a=#08:19:20 PM#

document.write("a=" & a & "<br/>")


document.write("........................<br/><br/>")


dim B(3)

B(0)="Ram"

B(1)="Raj"

B(2)="Sam"

B(3)="John"


for i =0 to 3

document.write(B(i) & "<br/>")

next

document.write("........................<br/><br/>")


for each i in B

document.write(i & "<br/>")

next


document.write("........................<br/><br/>")


Dim Emp

Emp=Array("Amit",25,#01/24/1990#)

for each i in Emp

document.write(i & "<br/>")

next

document.write("........................<br/><br/>")


public C(2,3)

C(0,0)=0

C(0,1)=1

C(0,2)=2

C(0,3)=3


C(1,0)=4

C(1,1)=5

C(1,2)=6

C(1,3)=7


C(2,0)=8

C(2,1)=9

C(2,2)=1

C(2,3)=2



for i=0 to 2

for j=0 to 3

document.write(C(i,j) & "  ")

next

document.write("<br/>")

next


document.write("Dynamic Array........................<br/><br/>")


private D()

Redim D(2)

D(0)="Ram"

D(1)=25

D(2)=25000

for each i in D

document.write(i & "<br/>")

next


document.write("Dynamic Array........................<br/><br/>")

redim preserve D(4)

D(3)="Delhi"

D(4)="IT"

for each i in D

document.write(i & "<br/>")

next



document.write("Dynamic Array........................<br/><br/>")

redim D(6)

D(5)=#01/05/1995#

D(6)="Dr. Mukherjee Nagar"

for i=0 To 6

document.write(i+1 & " Element= " & D(i) & "<br/>")

next

</script>

</body>

</html>

VBScript Class - 9

  VBScript Class - 9 by S P SHARMA CLASSES (7048972696)


<html>

<body>

<script type="text/VBScript">


document.write("Call byRef.............<br/><br/>")

function show(x)

x=x+3

show=x

end function


dim x

x=5

document.write("Before calling x=" & x & "<br/>")

call show(x)

document.write("After calling x=" & x & "<br/>")



document.write("Call byVal.............<br/><br/>")


function change(byVal y)

y=y+3

change=y

document.write("Inside change y=" & y & "<br/>")

end function


dim y

y=5

document.write("Before calling y=" & y & "<br/>")

call change(y)

document.write("After calling y=" & y & "<br/>")



document.write("Call byRef.............<br/><br/>")

function show1(byRef x1)

x1=x1+3

show1=x1

end function


dim x1

x1=5

document.write("Before calling x1=" & x1 & "<br/>")

call show1(x1)

document.write("After calling x1=" & x1 & "<br/>")


</script>

</body>

</html>

VBScript Class - 8

  VBScript Class - 8 by S P SHARMA CLASSES (7048972696)


<html>

<body>

<script type="text/VBScript">


document.write("<br/>...................</br></br>")

x=1

do 

if x=5 then exit do

document.writeln(x & "<br>")

x=x+1

Loop while x<11


document.write("<br/>...................</br></br>")

x=1

do while x<11

if x=5 then exit do

document.writeln(x & "<br>")

x=x+1

Loop 



document.write("<br/>...................</br></br>")

x=1

do until x>11

if x=5 then exit do

document.writeln(x & "<br>")

x=x+1

Loop 


document.write("<br/>...................</br></br>")

x=1

while x<11

'if x=5 then exit do

document.writeln(x & "<br>")

x=x+1

wend



document.write("<br/>...................</br></br>")

dim emp(2)

emp(0)="Ram"

emp(1)=5

emp(2)=8.6

'emp(3)="Raj"

document.write("emp(0)=" & emp(0) & "<br/>")

document.write("emp(1)=" & emp(1) & "<br/>")

document.write("emp(2)=" & emp(2) & "<br/>")


document.write("<br/>...................</br></br>")

dim std(4)

std(0)="Ram"

std(1)="Raj"

std(2)="Sam"

std(3)="John"

std(4)="Amit"

for each x in std

document.write(x & "<br/>")

next

document.write("<br/>...................</br></br>")

call show()


sub show()

document.write("Hello from VBScript Sub Procedure<br/>")


end sub


call show()

call display()

function display()

document.write("Hello from VBScript Function<br/>")


end function

call display()


document.write("<br/>...................</br></br>")


sub show1(x)

document.write("x=" & x &"<br/>")

end sub


call show1(10)



function findarea(r)

const pi =3.14

area=pi*r*r

document.write("area=" & area &"<br/>")

end function


findarea(3)

call findarea(2)


document.write("<br/>...................</br></br>")

function findarea(r)

const pi =3.14

area=pi*r*r

findarea=area

end function



document.write("area=" & findarea(10) &"<br/>")


k=findarea(20)

document.write("area=" & k &"<br/>")


r1=inputbox("Enter the radius of circle")

k=findarea(r1)

document.write("area=" & k &"<br/>")


</script>

</body>

</html>

VBScript Class - 7

 

 VBScript Class - 7 by S P SHARMA CLASSES (7048972696)


<html>

<body>

<script type="text/VBScript">

Dim i, j 

For i = 1 To 5

For j = 1 To 5

document.write(j)

Next

document.write("<br/>")

Next


document.write("<br/>...................</br></br>")


For i = 1 To 5

For j = 1 To 5

document.write(i)

Next

document.write("<br/>")

Next



document.write("<br/>...................</br></br>")


For i = 1 To 5

For j = 1 To i

document.write(j)

Next

document.write("<br/>")

Next


document.write("<br/>...................</br></br>")


dim x

x=1

do while x<5

document.writeln(x)

x=x+1

Loop



document.write("<br/>...................</br></br>")


'dim x

x=1

do while x<5

x=x+1

document.writeln(x)

Loop




document.write("<br/>...................</br></br>")



x=1

do 

document.writeln(x)

x=x+1

Loop while x<5



document.write("<br/>...................</br></br>")



x=1

do 

x=x+1

document.writeln(x)

Loop while x<5



document.write("<br/>...................</br></br>")

x=1

do 

x=x+1

document.writeln(x)

Loop while x<1



document.write("<br/>...................</br></br>")

x=1

do while x<1

x=x+1

document.writeln(x)

Loop




document.write("<br/>...................</br></br>")

x=1

do until x=5

document.writeln(x)

x=x+1

Loop


document.write("<br/>...................</br></br>")

x=10

do until x>5

document.writeln(x)

x=x-1

Loop



document.write("<br/>...................</br></br>")

x=10

do until x<5

document.writeln(x)

x=x-1

Loop




document.write("<br/>...................</br></br>")

x=1

while x<5

document.writeln(x)

x=x+1

wend

</script>

</body>

</html>

VBScript Class - 6

 VBScript Class - 6 by S P SHARMA CLASSES (7048972696)


<html>

<body>

<script type="text/VBScript">


for i=1 to 5

document.write(i)

next

document.write("<br/><br/>")


for i=1 to 10

document.write(i)

i=i+2

next


document.write("<br/><br/>")


for i=1 to 10 step 2

document.write(i)

next


document.write("<br/><br/>")


for i=10 to 1 step -1

document.write(i)

next

</script>

</body>

</html>

VBScript Class - 5

 

VBScript Class - 5 by S P SHARMA CLASSES (7048972696)



 <html>

<body>

<script type="text/VBScript">

a=5

if a=7 then

document.write(  "7 <br/>")



elseif a=5 then

document.write( " 5 <br/>")

 


elseif a>4 then

document.write( " 4 <br/>")

else

document.write( " 10 <br/>")

end if

</script>

</body>

</html>

VBScript Class - 4

VBScript Class - 4 by S P SHARMA CLASSES (7048972696)


 <html>

<body>

<script type="text/VBScript">


a=inputBox("Enter a number")

if a mod 2=0 then

document.write("Even Number "& "<br/>")

else

document.write("Odd Number "& "<br/>")

end if



dim color

color=inputbox("Enter the color code")

select case color

case "r"

document.write("This is a red color")

case "g"

document.write("This is a green color")

case "b"

document.write("This is a blue color")

case else

document.write("This is an invalid color")

end select

</script>

</body>

</html>

VBScript Class - 3

 

VBScript Class - 3 by S P SHARMA CLASSES (7048972696)


<html>

<body>

<b id="k"></b>

<script type="text/VBScript">

a=6

b=4

document.write(a<>b & "<br/> Hello")

'document.write(a!=b & "<br/>")

document.write("a=b" & a = b & "<br/>")

document.write(a mod b & "<br/>")

document.write(a & "<br/> India")

document.write(b & "<br/>")

document.write(a+b & "<br/> Delhi")



a=5-2*2/5^3

document.write("<br/>a=" & a & "<br/>")

b=6*2/3

document.write("<br/>b=" & b & "<br/>")



a=True

if a =true then

document.write("Hello India"& "<br/>")

end If

document.write(a& "<br/>")



a=inputBox("Enter a number")

if a = 5 then

document.write("Hello Delhi"& "<br/>")

else

document.write("India"& "<br/>")

end if

</script>

</body>

</html>

VBScript Class - 2

 

VBScript Class - 2 by S P SHARMA CLASSES (7048972696)



<html>

<body>

<b id="k"></b>

<script type="text/VBScript">

'option explicit

dim a

a=5

document.writeln("a=" &a& "<br/>")

document.write("Numeric Represention of a=" & VarType(a) & "<br/>")

document.write("Text Represention of a=" & TypeName(a)& "<br/>")


dim b

b=empty

document.writeln("b=" &b& "<br/>")

document.write("Numeric Represention of b=" & VarType(b) & "<br/>")

document.write("Text Represention of b=" & TypeName(b)& "<br/>")


'dim b

b=null

document.writeln("b=" &b& "<br/>")

document.write("Numeric Represention of b=" & VarType(b) & "<br/>")

document.write("Text Represention of b=" & TypeName(b)& "<br/>")


b="Ram"

document.writeln("b=" &b& "<br/>")

document.write("Numeric Represention of b=" & VarType(b) & "<br/>")

document.write("Text Represention of b=" & TypeName(b)& "<br/>")


b=True

document.writeln("b=" &b& "<br/>")

document.write("Numeric Represention of b=" & VarType(b) & "<br/>")

document.write("Text Represention of b=" & TypeName(b)& "<br/>")

</script>


</body>