You are on page 1of 4

Practical No7: Create a web page to implement Form Events Part I

Program No: 1
onclick:

<html>
<head>
<title>onClick Demo</title>
</head>
<script>
function i1()
{
alert("WELCOME TO INDIA");
}
function i2()
{
alert("WELCOME TO USA");
}
function i3()
{
alert("WELCOME TO CHINA");
}
</script>
</head>
<form>
<input type="button" name="b1" value="India" onclick="i1()">
<input type="button" name="b2" value="USA" onclick="i2()">
<input type="button" name="b3" value="China" onclick="i3()">
</form>
</html>

Output:
Program No:2
Onbdbclick:

<html>
<head>
<title>ondblClick Demo</title>
</head>
<script >
function message()
{
alert("double clicked...");
}
</script>
</head>
<form>
<input type="button" name="b1" value="India" ondblclick="message()">
</form>
</html>

Output:

Program No: 3
Onmousemove:

<html>
<head>
<title>Mouse event Demo</title>
</head>
<script>
function move()
{
alert("Mouse moves");
}
</script>
</head>
<form name="frm1">
<textarea name="ta1" rows="10" cols="10" onmousemove="move()">
write here...
</textarea>
</form>
</html>

Output:

Program No:4
onmouseover & onmouseout:

<html>
<head>
<title>Mouse event Demo</title>
</head>
<script>
function over()
{
document.frm1.b1.value="Mouse Over";
}
function out()
{
document.frm1.b1.value="Mouse Out";
}
</script>
</head>
<form name="frm1">
<input type="button" name="b1" value="Click" onmouseover="over()"
onmouseout="out()">
</form>
</html>
Output:

You might also like