Events are facts that occur during system implementation, from which the programmer can define actions to be performed by the program. Below is the list of possible events in Javascript, indicating the times when they may occur as well as the subject of its occurrence objects:


  • onload – Occurs in charge of the document. That is, only occurs in the BODY of the document;
  • onunload – occurs in the discharge (output) of the document. Also only occurs in the BODY;
  • onchange – Occurs when the object loses focus and there was a change of content. Valid for objects Text, Select and Textarea;
  • onblur – Occurs when the object loses the focus, irrespective of the existence change. Valid for objects Text, Select and Textarea;
  • onfocus – Occurs when the object receives focus. Valid for objects Text, Select and Textarea;
  • onclick – Occurs when the object receives a Click of the Mouse. Valid for Buton objects, Checkbox, Radio, Link, Reset and Submit;
  • onmouseover – Occurs when the mouse pointer passes over the object. Only valid for Link;
  • onselect – Occurs when the object is selected. Valid for Text and Textarea objects;
  • onsubmit – Occurs when a Submit type button receives a click of the mouse. Only valid for the Form.


JavaScript allows the programmer to write lines within a page (document) through the write method. The lines written in this way, can contain text, HTML and JavaScript expressions commands. The lines written by this method will appear on the screen point where the command is entered. For example:



value = 30

document.write (“My first line <br>”)

document.write (“This line appears the result of” +

(10 * 10 + value))

</ script>


The idea of ​​the above example is to write two lines. To prevent the two lines are written on the same line is used to HTML tag to make a line break. When writing a document is required, then the use of another essential feature: the functions.

A function is an instruction set, which should only be performed when the function is activated. The general syntax is as follows:

function functionName (parameters) {Action}

Suppose a function that aims to inform if a person is more or less old, receiving as parameter the age:

function Age (Years) {

if (Years> 17) {

alert (“Greater Age.”)

} Else {

alert (“Minor Age.”)




To activate this function, suppose a text box on a form, in which the old is informed, and every information, the function is triggered.


<input type = text size = 2 maxlength = 2 name = “Time” onchange = “Age (Time.value)”>

</ form>

Note that the last parameter (when the event “onchange” occurs) was the contents of the text box “Time” (property “value”) and that in the function we call “Years”. I.e., there is no correlation between the name of the variable passed and receiving variable in the function. Only the content is passed.

You might also like…

Scriptcase uses the MVC template?

Maybe you might have thought about this at some point, “Scriptcase uses the MVC templates?" Well, ...

How to implement A2F using Own Development in NodeJS in a Scriptcase application

A2F using Own Development in NodeJS A2F: In a previous article, we talked about Swivel as an extern...

Specialists or generalists, who gets a better advantage by using Scriptcase?

Hey there! Today  we will figure what are the ideal profiles for those who wish to take advantage o...

Comment this post

Get new posts, resources, offers and more each week.

We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at Learn more about our Privacy Police.