JavaScript – Forms

Javascript and Forms In javascript for every <form> </form> tags, a form object is created. Then We can access the form and its elements. The first method is to use forms array. The forms array allows access to a form using index. Each <form> element of HTML document will be an item in forms array. […]

JavaScript – Regular Expressions

Regular Expression The regular expressions are used to form patterns that can be matched against strings. For example, suppose a text string needs to be validated to check whether its an email addresses, for this string object does not provide any method except to compare strings which is not accurate and to overcome this problem […]

JavaScript – Strings, Math and Number Object

String Object The string object provide several properties and methods to work around strings. The string objects can be created using new keyword. For example: var x = new String(“Hello”);   The string literals are created by assigning the value to a variable. For example: var y = “Hello”;   In the above example, the […]

JavaScript – Event Handling

Event Handling Any action that a user performs on a web page is known as an event. Like moving of mouse, clicking button, clicking a link, text input, selection or even loading a page. Event handlers are used to handle an event on a web page. JavaScript has a predefined event handler as property of […]

JavaScript – Window Object

Window Object The entire HTML page is modelled as a document object. Similarly the window in web browser is modelled as Window object. The window object include three methods to create dialog boxes for various kind of interaction with the users.   JavaScript Alert alert() method The alert() method is used to open a dialog […]

JavaScript – Document Object

Document Object The document object is created by the browser for each new HTML page that is viewed. We have already seen write() method of the document object which writes a text into an HTML document. The document object works based on the Document Object Model (DOM). Each HTML document is treated as a structure […]

JavaScript – Arrays

JavaScript Arrays An array is a way of storing list of data   Defining Arrays Array Constructor var arrayname = new Array(); creates empty array var student = new Array(5);  creates array with 5 items It is not necessary to set the length of an array, it can vary as needed during script execution. Values […]

JavaScript – Operators

JavaScript Operators An operator in javascript is a symbol or keyword that performs some sort of calculation. JavaScript uses different types of operators: Arithmetic Assignment Comparison Logical Bitwise Special   Arithmetic Operators: Addition (+), subtraction (-), multiplication (*), Division (/), modulus (%), increment (++) pre and post, decrement (–) pre and post Type coercion is […]

JavaScript – Functions

Javascript Functions The purpose of functions is to execute single or series of statements. Functions are used to organize the script into different tasks. The most important purpose of the functions is reusability. The functions are written once and can be used or called any number of times within the script. In javascript function needs […]