Professional Documents
Culture Documents
Aprajita WT Exp 6 To 9
Aprajita WT Exp 6 To 9
Aprajita WT Exp 6 To 9
PRACTICAL NO. 7
Title: Write a program in which when page loads it will ask you for entering number & it will display the
Objective: To check whether you enter the number at the loading of the page.
CODE:-
<html>
<head>
<title>Table in Java Script</title>
<script language="javascript">
var i;
for (k=1;k<=10;k++
{ document.write("<tr><td>");
document.write("</td><td>");
document.write(i * k);
document.write("</td></tr>");
}
document.write("</table>")
</script>
</head>
Deepanshu 2002833
DEPARTMENT OF INFORMATION TECHNOLOGY
<body>
</body>
</html>
Output-:
Deepanshu 2002833
DEPARTMENT OF INFORMATION TECHNOLOGY
PRACTICAL NO. 8
Title: Write a script that evolutes the factorials of integers from 1 to 10 display the result in HTML table
format.
CODE:-
<html>
<head><title>Factorial in Java Script</title>
<script language="javascript">
function fact(k)
{
if (k==1)
{
return 1;
}
else
return k*fact(k-1);
}
var i;
Deepanshu 2002833
DEPARTMENT OF INFORMATION TECHNOLOGY
document.write("<tr><td>");
document.write("Factorial of " + k);
document.write("</td><td>");
document.write(fact(k));
document.write("</td></tr>");
}
document.write("</table>")
</script>
</head>
<body>
</body>
</html>
Output-:
Deepanshu 2002833
DEPARTMENT OF INFORMATION TECHNOLOGY
Deepanshu 2002833
DEPARTMENT OF INFORMATION TECHNOLOGY
PRACTICAL NO. 9
Objective: Swap the two images to change one image to another using mouse pointer that helps in event
driven programming.
CODE:-
<html>
<head><title>swapping of two images</title>
<script language="javascript">
function swapimages(a,b)
{ var v1=document.images[a].src;
document.images[a].src=document.images[b].src;
document.images[b].src=v1;
}
</script>
</head>
<body><div align=center>
<img src="F:\pictures\Chateau.jpg" height=250 width=250>
<img src="F:\pictures\Paradise.jpg" height=250 width=250><p>
<form>
<input type="button" value="swap the two images" onclick="swapimages(0,1)">
</form>
Deepanshu 2002833
DEPARTMENT OF INFORMATION TECHNOLOGY
</div>
</body>
</html>
Output:
Deepanshu 2002833