ncthakur.itgo.com     Javascript: Image Rollover

         NEPAL     |     ARTICLES     |     KAVITAHARU    |     MANTHAN    |     COOL LINKS    |     GUESTBOOK    |     SEARCH

JAVASCRIPT
As I have learned as a beginner:
1. Opening New Window

2. Use of Alert, Prompt & Confirm

3. Document Write

4. Use of Function

5. Event Handlers (Image Rollover)

6. If and Else Statement

7. Predefined Object (Date)

8. Cut & Paste JavaScript

NEPAL
Overview of Nepal
Map & images
Nepalese websites

KAVITAHARU
View few of my poems
written in Nepali language

ARTICLES
Articles on
crime prevention
investigation
& crime control

COOL LINKS
Computer
Travel & Tour
Police World
Downloads
Personality Test
Nepal News
Crime & Police News
Nepali Music
Health
Horoscope
Monthly Poll
Other

ADD EMAIL
Search or add email to the search list.

GUESTBOOK
View to find out what other visitors have to say about this web site.

KURAKANI
Are you interested to chat? Go to Kurakani room.

FREE E-CARDS
Enormous free E-Cards of your choice. Send it to your friend and family members.

FREE SITE SUBMIT
Submit your web site to the major search engines here.

ABOUT ME
Click here to find out about me and view few of my photographs.

 

Event Handlers (Image Rollover)

If user makes JavaScript program to react while clicking on a button or moving mousepointer on a link. It is said to be click- event and MouseOver- event respectively. So the event handler are 0nClick, onMouseover, onMouseout, onLoad, onUnload, onReset, onSelect, onSubmit, onFocus, onBlur, onChange, onAbort, onError etc, which are used in either in <a href=""></a> or <input type=""> using <form>.

Image Object
Properties: src, height, width, border, vspace, hspace
Method: onMouseover, onMouseout, onLoad, onUnload, onError, onAbort

Example using <a href>
<A HREF="javascript:void(0)"
onMouseOut="Image.src='your image2.gif'"
OnMouseOver="Image.src='your image1.gif'">
<IMG name="Image" src="your image2.gif" border=0></A>



Event will occur when we put mousepointer over the image which is a OnMouseOver event and again another event will take place when we move the mousepointer out of the image which is OnMouseOut event and both are the event handler. The change of images known as image rollover needs two images, when mousepointer is placed on an image, another image will be loaded and, the first one will be loaded again when mousepinter is rolled out of the image.

Another example using <form>
<form>
<IMG NAME="cheetah" src="cheetah02.gif">
<INPUT TYPE="BUTTON" VALUE="STOP" onClick="cheetah.src='cheetah02.gif'">
<INPUT TYPE="BUTTON" VALUE="RUN" onClick="cheetah.src='cheetah.gif'">
</form>





Events have been made to occur using onClick event handler with the use of <FORM>.

"for" loop
As I have understood, a for loop is used if someone wants to repeat an action several times. Here is an example of the use of a for loop.

Example of "for" loop
<script language="JavaScript>
<--hide from older browser
for (y=0; y<=5; y++){
alert("Hi! there")
}
//-->
</script>

This will alert "Hi! there" six times.
y=0 is a starting point of a for loop.
y=5 is maximum boundary of for loop.
y=++ is for incrementing for loop one step each time until the maximum boundary.

BACK

NEXT..........


Top

Home  | About Me  |  Nepal  |  Articles  | Kavitaharu  | Cool Links 
 Javascript  | Add Email  |  Guestbook