0% found this document useful (0 votes)
75 views3 pages

JS Practical 7

The document contains code snippets demonstrating how to handle different events in HTML forms. The first snippet shows how to use the onblur event to style an input field and convert its text to uppercase when it loses focus. The second snippet uses the onload event to display an alert when the page finishes loading. The third snippet demonstrates the onclick event by displaying bold text when a submit button is clicked.

Uploaded by

sakshi
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)
75 views3 pages

JS Practical 7

The document contains code snippets demonstrating how to handle different events in HTML forms. The first snippet shows how to use the onblur event to style an input field and convert its text to uppercase when it loses focus. The second snippet uses the onload event to display an alert when the page finishes loading. The third snippet demonstrates the onclick event by displaying bold text when a submit button is clicked.

Uploaded by

sakshi
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/ 3

Practical 7

/* 1.Write a program to design a form and handle onblur Event*/

<html>
<script>
function blur_event()
{
document.getElementById("n1").style.background =
"yellow";
var x = document.getElementById("n1");
x.value = x.value.toUpperCase();
}
</script>
<body>
<br> Enter Name = <input type="text" name="n1" id="n1"
onblur="blur_event()" /> <br>
<p><input type="submit" value="Submit"></p>
</body>
</html>

/* 2.Write a program to design a form and handle onload Event*/


Practical 7

<htmL>
<head>
<title> ONLOAD EVENT </title>
</head>
<script>
function load()
{
alert("Page is loaded");
}
</script>
<body onload="load()">
<h2>HELLO WORLD</h2>
</body>
</html>

/* 3.Write a program to design form and handle onclick Event */


Practical 7

<htmL>
<head>
<title> CLICK EVENT </title>
</head>
<script>
function click_event()
{
document.write("<b>THANK YOU</b>");
}
</script>
<body>
<p><input type="submit" value="Click Here!!"
onclick="click_event()"> </p>
</body>
</html>

You might also like