Abc
Abc
Message printing
<html>
<head>
<title>Message</title>
</head>
<body>
<script>
document.write("Welcome to JavaScript");
</script>
</body>
</html>
2.Arithmetic
<html>
<head>
<title>Arithmetic operation</title>
</head>
<body>
<script>
var a=20;
var b=30;
var res;
res=a+b;
document.write("Addition="+res+"<br>");
res=a-b;
document.write("Substraction="+res+"<br>");
res=a*b;
{
document.write("Multiplication="+res+"<br>");
res=a/b;
document.write("Division="+res+"<br>");
res=a%b;
document.write("Remainder="+res+"<br>");
</script>
</body>
</html>
<html>
<head>
</head>
<body>
<script>
res=a+b;
document.write("Addition="+res+"<br>");
</script>
</body>
</html>
4.largest number
<html>
<head>
<title>Largest number</title>
</head>
<body>
<script>
var a=20;
var b=15;
if(a>b)
else
</script>
</body>
</html>
5.gratest among 3
<html>
<head>
</head>
<body>
<script>
var a=20;
var b=15;
var c=10;
if(a>b && a>c)
else
</script>
</body>
</html>
6.Switch case
<html>
<head>
<title>Switch case</title>
</head>
<body>
<script>
switch(ch)
case 1:
document.write("Monday");
break;
case 2:
document.write("Tuesday");
break;
case 3:
document.write("Wednesday");
break;
case 4:
document.write("Thursday");
break;
case 5:
document.write("Friday");
break;
case 6:
document.write("Saturday");
break;
case 7:
document.write("Sunday");
break;
default:
document.write("Invalid number");
</script>
</body>
</html>
7.Array
<html>
<head>
<title>Array</title>
</head>
<body>
<script>
item[0]="Apple";
item[1]="Banana";
item[2]="Mango";
item[3]="Kiwi";
item[4]="Orange";
document.write("item is="+item[0]+"<br>");
document.write("item is="+item[1]+"<br>");
document.write("item is="+item[2]+"<br>");
document.write("item is="+item[3]+"<br>");
document.write("item is="+item[4]+"<br>");
</script>
</body>
</html>
8.Length of array
<html>
<head>
<title>Length of array</title>
</head>
<body>
<script>
document.write("Length of Array="+l1.length+"<br>");
document.write("Length of Array="+l2.length+"<br>");
document.write("Length of Array="+l3.length+"<br>");
</script>
</body>
</html>
9.Sorting
<html>
<head>
<title>Sorting</title>
</head>
<body>
<script>
var a=[12,23,44,15,54,32];
document.write("Before sorting"+a+"<br>");
a.sort();
document.write("Sorted Array"+a);
</script>
</body>
</html>
10.changing element of an array
<html>
<head>
</head>
<body>
<script>
var a=["Abc","Lmn","Opq","Rst","Uvw"];
a.push("xyz");
a.pop();
a.shift();
a.reverse();
</script>
</body>
</html>
<html>
<head>
<title>function</title>
<script>
function add(a,b)
{
document.write("Addition is"+(a+b));
</script>
</head>
<body>
<script>
add(4,8);
</script>
</body>
</html>
<html>
<head>
<script>
function add(a,b)
var add=a+b;
return add;
c=add(5,6);
document.write("Addition="+c);
</script>
</head>
<body>
<script>
add();
</script>
</body>
</html>
13.calling from html
<html>
<head>
<script>
funtion open()
alert("Welcome");
function colse()
alert("Thank you");
</script>
</head>
</body>
</html>
14.convert
<html>
<head>
<title>Convert</title>
</head>
<body>
<script>
<p>By integer</p>
var a=12.3;
document.write(parseInt(a));
</script>
</body>
</html>
15.uppercase lowercase
<html>
<head>
</head>
<body>
<script>
var str="ABC";
document.write(str.toLowercase());
var str1="abc";
document.write(str1.toUppercase());
</script>
</body>
</html>
16.retrive positon
<html>
<head>
<body>
<script>
document.write("character is ="+str1.CharAt(5));
</script>
</body>
</html>
17retrive index
<html>
<head>
<body>
<script>
document.write("character is ="+str1.indexOf('I'));
</script>
</body>
</html>
18 student registration
<html>
<head>
<title>Student Registration</title>
</head>
<body>
<script>
<form>
<P>Gender</p>
<br><br>
<h3>Subjects</h3>
</form>
</script>
</html>
19.online shopping
<html>
<head>
<title>Online Shoping</title>
</head>
<body>
<script>
<form>
</form>
</script>
</body>
</html>
20.onclick
<html>
<head>
<title>Onclick</title>
<script>
function fy()
alert("Welcome to FYIT");
}
function sy()
alert("Welcome to SYIT");
function ty()
alert("Welcome to TYIT");
</script>
</head>
<body>
<form>
</form>
</body>
</html>
21.ondblclick
<html>
<head>
<title>Ondblclick</title>
<script>
function msg()
alert("Welcome to CSS");
</script>
</head>
<body>
<form>
</form>
</body>
</html>
<html>
<head>
<script>
function mover()
document.Myform.b1.value="Mouseover";
function mout()
document.Myform.b1.value="Mouseout";
</script>
</head>
<body>
<form name="Myform">
</form>
</body>
</html>
23.keyevents
<html>
<head>
<title>Keyevents</title>
<script>
function down()
alert("Key is pressed");
function up()
alert("key is released");
function press()
</script>
</head>
<body>
<form>
</form>
</body>
</html>
24.Intrinsic function
<html>
<head>
<title>Intrinsic function</title>
</head>
<body>
<form name="Myform">
</form>
</body>
</html>
25.Disable
<html>
<head>
<title>Disable</title>
<script>
function enable()
document.forms.Myform.name.disabled=false
function disable()
document.forms.Myform.name.disabled=true
</script>
</head>
<body>
<form name="Myform">
</form>
</body>
</html>
26.Readonly
<html>
<head>
<title>ReadOnly</title>
<script>
function readonly()
document.forms.Myform.name.readOnly=true
</script>
</head>
<body>
<form name="Myform">
</form>
</body>
</html>
27.changing window
<html>
<head>
<script>
function openw()
window.open("","","width=300 height=400");
this.focus();
function openmul()
for(var i=0;i<3;i++)
function changecontent()
function close()
a.close();
</script>
</head>
<body>
<form>
</form>
</body>
</html>
28.metacharacter
<html>
<head>
<title>Metacharacter</title>
<script>
var a=/\d/
function test()
var str=textfield.value;
if(a.test(str))
alert("Valid")
else
alert("Invalid")
</script>
</head>
<body>
</html>
29.Banner
<html>
<head>
<title>Banner</title>
<script>
Mybanner=new Array('g1.png','g2.png','g4.png','g5.png');
var banner=0;
function display()
document.getElementById("BannerChange").src=Mybanner(banner);
if(banner<(Mybanner.length-1))
banner++;
else
banner=0;
</script>
</head>
<body>
<center>
</center>
</body>
</html>
30.Banner link
<html>
<head>
<title>Bannerlink</title>
<script>
Mybanner=new Array('g1.png','g2.png','g4.png',);
Mybannerlink=new Array('https://www.google.com','https://www.gmail.com','https://yahoo.com');
var banner=0;
function displayLink()
document.location.href=Mybannerlink(banner);
function display()
document.getElementById("BannerChange").src=Mybanner(banner);
if(banner<(Mybanner.length-1));
banner++;
else
banner=0;
setInterval("display()" 2000);
</script>
</head>
<body onload="display()">
<center>
<a href="displaylink()">
</center>
</body>
</html>
31.slidshow
<html>
<head>
<title>slideshow</title>
<script>
slide=new Array('g1.png','g2.png','g4.png','g5.png');
var i=0;
function display(SlideNumber)
i=i+SlideNumber;
if(i>slide.length-1)
i=0;
if(i<0)
i=slide.length-1;
document.SlideID.src=slide[i];
</script>
</head>
<body>
</body>
</html>