0% found this document useful (0 votes)
5 views4 pages

Javascript 1

The document contains two HTML practicals demonstrating JavaScript functions that change the background color of a webpage in a sequence. In Practical 1, the color changes occur on mouse over, while in Practical 2, they happen automatically upon page load, with an alert displayed on page unload. Both practicals utilize similar functions to cycle through a series of colors with timed intervals.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

Javascript 1

The document contains two HTML practicals demonstrating JavaScript functions that change the background color of a webpage in a sequence. In Practical 1, the color changes occur on mouse over, while in Practical 2, they happen automatically upon page load, with an alert displayed on page unload. Both practicals utilize similar functions to cycle through a series of colors with timed intervals.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Practical 1

<html>

<head>

<title>javascript pgm1</title></head>

<body> <center><form>

<h1> Changes the Background Color onMouseOver and also displays the status </h1>

<input type=button value="Colors" onMouseOver='window. setTimeout ("f1()",1200)'>

<input type=button value=" Status " onClick='window. status=("Welcome I.T.Strudents")'>

</form>

<script language="javascript">

function f1()

document.bgColor="Orange";

window.setTimeout("f2()",1200);

function f2()

document.bgColor="blue";

window.setTimeout("f3()",1200);

function f3()

document.bgColor="Green";

window.setTimeout("f4()",1200);

function f4()

document.bgColor="Purple";

window.setTimeout("f5()",1200);

function f5()
{

document.bgColor="Cyan";

window.setTimeout("f6()",1200);

function f6()

document.bgColor="Brown";

window.setTimeout("f7()",1200);

function f7()

document.bgColor="Red";

window.setTimeout("f1()",1200);

</script>

</body>

</html>

Practical 2

<html>

<head>

<title>javascript</title>

</head>

<body onLoad='window.setTimeout("f1()",1200)' onUnload='alert("The page is unloaded")'>

<center>

<h1> Changes the Background Color Automatically and on Unload displays the appropriate message
</h1>

<script language="javascript">
function f1()

document.bgColor="Orange";

window.setTimeout("f2()",1200);

function f2()

document.bgColor="blue";

window.setTimeout("f3()",1200);

function f3()

document.bgColor="Green";

window.setTimeout("f4()",1200);

function f4()

document.bgColor="Purple";

window.setTimeout("f5()",1200);

function f5()

document.bgColor="Cyan";

window.setTimeout("f6()",1200);

function f6()

document.bgColor="Brown";

window.setTimeout("f7()",1200);

function f7()
{

document.bgColor="Red";

window.setTimeout("f1()",1200);

</script>

</body>

</html>

You might also like