Experiment No. 7 Create Web Page To Implement Form Event - Part I (Mouse Event)
Experiment No. 7 Create Web Page To Implement Form Event - Part I (Mouse Event)
7
Create web page to implement Form Event – Part I (Mouse Event) –
Create a web page with one textbox and two buttons labeled as Down and Up. When
user clicks on Up button the value from textbox will be increase by 1 (i.e. i++). When
user clicks on Down button the value from textbox will be decreased by 1 (i.e. i--).
CODE:
<!--
Aniket Gholap
30
EXP 7
-->
<!DOCTYPE html>
<html>
<head>
<title> Mouse Event </title>
</head>
<body>
<script>
function up() {
var i = document.frm1.t1.value;
i++;
document.frm1.t1.value = i;
}
function down() {
var i = document.frm1.t1.value.value;
i--;
document.frm1.t1..value = i;
}
</script>
<form name=”frm1”>
<input type = “text” name = “t1” > <br />
<input type = “button” name = “b1” value = “DOWN”onclick =
“down()”>
<input type = “button” name = “b2” value = “UP” onclick = “up()”>
</body>
</html>
OUTPUT:
Value Entered Down Button Pressed Up Button Pressed
----------------------------------------------------------------------------------------------------