Vaataanaa No. 1
Vaataanaa No. 1
// If-Else
<html>
<head>
<title>
Voter
</title>
<body>
<script>
age=20;
document.write("<br>");
if(age>18)
document.write("Elgilbe to vote");
else
document.write("Not Eligible");
</script>
</body>
</head>
Ouput :
// For-Loop
<html>
<head>
<title>For Loop</title>
</head>
<body>
<script>
document.write("<br>");
document.write(i);
document.write("<br>");
documen.write("Continue numbers");
</script>
</body>
</html>
Output :
// Switch Statement
<html>
<head>
<title>Switch Statement</title>
</head>
<body>
<script>
var ch="o";
switch(ch)
break;
break;
break;
break;
break;
</script>
</body>
</html>
Ouput :
//Do while loop
<html>
<head>
<title>
Do whilel loop
</title>
</head>
<body>
<script>
var x=0;
do{
document.write("Value="+x+"<br>");
x++;
while(x<=20);
document.write("Loop Exists")
</script>
</body>
</html>
Output :
Practical No. 2
//Sort Element
<html>
<head>
<title>Switch Statement</title>
</head>
<body>
<script>
var ch="o";
switch(ch)
break;
break;
break;
break;
break;
</script>
</body>
</html>
Ouput :
//Join and concat
<html>
<head>
<title>Join an array</title>
</head>
<body>
<script>
arr[0]="One";
arr[1]="Two";
arr[2]="Three";
var s1=arr.join();
document.write("String="+s1+"<br>");
var s2=arr.join("-");
document.write("String Join="+s2+"<br>");
arr2[0]="Four";
arr2[1]="Five";
arr2[2]="Six";
var s3=arr.concat(arr2);
document.write("String Concat="+s3+"<br>");
</script>
</body>
</html>
Output :
// add Element
<html>
<head>
<title>Add an array</title>
</head>
<body>
<script>
items[0]="One";
items[1]="Two";
items[2]="Three";
items[3]="Four";
items.push("Five");
items.unshift("Zero");
items.shift();
items.pop();
for(i=0;i<items.length;i++)
document.write(items[i]+" ");
</script>
</body>
</html>
Output :
Practical No.3
//calling with argument
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function func(a)
</script>
</head>
<body>
<script type="text/javascript">
func(10);
</script>
</body>
</html>
Output :
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function func()
return "Tanay";
</script>
</head>
<body>
<script type="text/javascript">
document.write(func());
</script>
</body>
</html>
Output :
// Addtiton
<!DOCTYPE html>
<html>
<head>
<title>addition Function</title>
</head>
<body>
<script type="text/javascript">
document.writeln(add(2,5));
</script>
</body>
</html>
Practical No.5
// Mouse Event
<head>
<title>House Events</title>
<script>
function react()
</script>
</head>
<body>
</form>
</form>
</body>
</html>
Output :
// Mouse Related Event
<html>
<body>
<div id="panel"></div>
<script>
function clickResponse()
function doubleclickResponse()
function mousedownResponse()
function mouseupResponse()
function init()
panel.onclick=clickResponse;
panel.ondblclick=doubleclickResponse;
panel.onmouseup= mouseupResponse;
panel.onmousedown= mousedownResponse;
</body>
</html>
Ouput :
Practical No.4
// Registration Form
<html>
<head>
</head>
<body>
<script>
function Click()
</script>
<option>C</option>
<option>C++</option>
<option>JAVA</option>
<option>ADV.JAVA</option>
<option>VB.NET</option>
</select>
</form>
</p>
</form>
</body>
</html>
Output :
Practical No. 6
// Key Events
<html>
<head>
<title>Key Event</title>
</head>
<body>
<div id="panel"></div>
<script>
var panel;
panel=document.getElementById("panel");
panel.innerHTML="Press a key...";
function keydown()
function keyup()
function keypress(e)
panel.innerHTML=String.fromCharCode(keynum);
</script>
</body>
</html>
Output :
Practical No. 7
//Intrinsic Function
<html>
<head>
</head>
<body>
<P>
<img src="submit.jpg"
onclick="javascript:document.forms.contact.submit()"/>
<img src="reset.jpg"
onclick="javascript:document.forms.contact.reset()"/>
</P>
</FORM>
</body>
</html>
Output :
// Disabling the elements
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>
disableButton.addEventListener('click', function() {
textInput.disabled = true;
checkbox.disabled = true;
disableButton.disabled = true;
});
</script>
</body>
</html>
Output :