Image Event Form Object

Image, Event, and Form Object

Image Object

It embeds an image or video clip into the current document. The img tag allows the insertion of .jpg, .png, .bmp abd .gif image files into HTML document. In many web application, it is important to know whether a specific image has been loaded, or in the process of loading or the loading process is interrupted. The image event handling provides this capability.

Event Event Handling Attribute Description
Load OnLoad This event handling occurs when an image is loaded and displayed into the browser window.
Error OnError This image event occurs when an error occurs during the loading process of an image.
Abort OnAbort This image event occurs when the user interrupts or cancels the loading of an image.
KeyDown OnKeyDown This image event is occurred when the user presses the down key of the keyboard.
<html>  
<head>  
</body>  
<h1>Testing Image Event Handling</h1>  
<img src="test.jpg" alt="test" onLoad='alert("image successfully loaded");' onError='alert("Error in loading image");'/>  
</body>  
</html>

Event Objects

Event Event Handling Attribute Description
Click OnClick This link event occurred when a user clicks the link.
DblClick OnDblClick This link event occurred when a user double clicks the link.
MouseDown OnMouseDown This link event occurred when a user presses the mouse button over the link.
MouseUp OnMouseUp This link event occurred when a user releases the pressed mouse button.
MouseOver OnMouseOver This link event occurs when the user moves the mouse pointer over a link.
<html>  
<head>  
<script type="text/JavaScript">  
function test(x)  
{  
alert(x);  
}  
</script>  
</head>  
<body>  
<h1>Testing Link Event</h1>  
<a href="https//:www.programmingdigest.com" onClick='test("you have clicked the link");'</a >  
</body>  
</html>

Form Object

A form provides different GUI (Graphical User Interface) objects or elements that are used to send and receive information to and from the webserver. These objects include buttons, text boxes, checkboxes, radio buttons, etc. each object is associated with a number of events.

Event Event Handling Attribute Description
Submit OnSubmit This event occurs when a user clicks the submit button in order to submit the form data to the form processor.
Reset OnReset This event handling is occurs when the user clicks the reset button of the form.
<html>  
<head>  
</head>  
<<body>  
<h1>Testing Form Event Handling </h1>  
<form onSubmit='alert("You are submitting data");'>  
Enter your name: <input type="text" >  
<input type="submit" value ="submit data">  
</form>  
<body>  
</html>