JavaScript - JavaScript Tutorial
JavaScript Tutorials is one of the best Quick reference to the JavaScript. In this JavaScript reference you will find most of the things about java script. JavaScript tutorial is classified into sections with examples. This tutorial is mainly for the beginners but experienced programmer can also learn many things from this JavaScript tutorial series.
This JavaScript Tutorial will teach you the fundamentals of JavaScript programming, including the use of the core JavaScript objects and the syntax of the language like statements, conditionals, loops, functions, etc. You will also learn how to immediately put JavaScript to validate forms, calculate values, work with image rollovers and create other user interface.JavaScript is widely used scripting language for mainly validating the user input on the client side (browser). It is also used with the DHTML for creating interactive user interface design.
- What is
JavaScript?
This section will introduce with the Java Scripting language. You will learn the benefits of using JavaScript in your programming.
Fundamentals of JavaScript Language - Writing
Simple JavaScript Example
In this section we will learn how to write simple JavaScript program and run in the Internet Explorer.
- Statements
In JavaScript
Learn JavaScript Statements.
- JavaScript
Variables and Data types
In this section you will learn how to use Variables and Data types in JavaScript.
- String and
Number operations in JavaScript
In this section you will learn String and Number operations in JavaScript.
- Conditional
examples (if else - switch case) In JavaScript
In this section you will learn the conational statements in JavaScript.
- Conditions In Java Script
Java Script is Netscape's Cross - platform, Object - based Scripting language for Client and Server applications. It is a Case sensitive application.
- Looping
in JavaScript
In this section you will learn example to use while, do-while and switch loops in JavaScript
- Functions in
JavaScript
This lesson introduces you with the Function in JavaScript. You will learn how to create and use Functions in JavaScript.
- Error
Handling in JavaScript
In this lesson you will learn about error handling in JavaScript.
- Simple
Calculator in JavaScript
In this lesson we will write simple Calculator program in JavaScript.
JavaScript as Object Oriented Scripting Language - Understanding
the Object Oriented Feature of JavaScript
In this lesson your will learn the Object Oriented Feature of JavaScript.
- Classes and
Objects
After learning this lesson you will be able to use Classes and Object in JavaScript.
- Form
Validation with JavaScript
In this lesson you will learn form validation in JavaScript.
- Dynamically
swapping the images with JavaScript
In this lesson you will learn how to Dynamically swap the images with JavaScript.
- JavaScript
with Link and Images
This lesson shows you how to use JavaScript with Link and Image.- Using onMouseOver and onMouseOut
- Using onClick to process clicks on hyperlinks
- Having hyperlinks call functions via javascript: URLs
- Conditionally navigating the user to a page when
they click a link
- Navigation
with combo box and JavaScript
In this lesson you will learn how to navigate to some other URL when use selects a link from the combo box.
- Popup windows
with JavaScript
In this lesson you will learn how to create popup window using JavaScript.
- Form
validation using Regular Expression in JavaScript
In this lesson you will learn form validation using regular expressions.
- Email validation is JSP using JavaScript
I this example we will show you how to validate email address in you JSP program using JavaScript.
- Java Script Code of Calendar and Date Picker or Popup Calendar
This is detailed java script code that can use for Calendar or date picker or popup calendar. In the code given below there are three files...
- JavaScript Combo Box Validation
In this example we create a combo box of different technologies where if user select any technology and press.
- JavaScript createPopup method
In our this part of JavaScript methods we will describe you how you can create a popup window by using the simple JavaScript in an HTML page.
- JavaScript appendChild method
In JavaScript if we want to append the HTML child element to any previously existing element then we can use appendChild() to add the child element.
- JavaScript add method
The add() method is used to add an option to a dropdown list. Here in this example we have added an option to the select tag by using the add() method.
- JavaScript addImport example
The addImport() method adds style sheets to the document by importing the style sheets collection.
- JavaScript appendData method
In JavaScript if we want to append some of the data to the HTML content that already exists then we can use appendData() method .
- JavaScript applyElement method Example
The user can apply some properties to the element of the HTML document by using the method applyElement(), which is called on some object of element.
- JavaScript blink method
Some times you need that some of the html text blinks on the browser again and again without using any kind of picture or image so to add this functionality with the JavaScript we can use simple blink() method.
- JavaScript bold method
One of the method defined in the string to show bold string value in the html page can be used to bold the text on the document.
- JavaScript clear method
We can clear string from a selected string or text by the use of selection object's clear() method.
- JavaScript clearTimeOut method
JavaScript's HTML DOM window object method clearTimeOut() method is used to stop or clear the time out variables value.
- JavaScript click method
In the html page we can select the check box either by clicking on the checkbox option while selecting any option or we can call the JavaScript method click() on the checkbox object.
- JavaScript cloneNode example
As it is clear with its name that it clones the node. JavaScript cloneNode() method creates a clone copy of the given node object and returns the clone node object.
- JavaScript createAttribute method
In the HTML JavaScript we have one of the important method createAttribute which can be used to create the html tag's attribute dynamically.
- JavaScript createCaption method
In the JavaScript we can add the table's caption dynamically by using the method createCaption().
- JavaScript createComment method
We can use the JavaScript method createComment to create the comment in the JavaScript. In the following tutorial we have shown the use of createComment() method in the JavaScript.
- JavaScript createEventObject method
If user wants to create and add any event to the specified object then its possible to create and add event to the objects with the help of JavaScript.
- JavaScript
createTFoot method
We can add header and footer also to the table by using the JavaScript in a similar manner as we have added and deleted the caption to the specified table.
- JavaScript createTHead method
In JavaScript we can create and add table header to the specified table by using the method createTHead() on the table object.
- JavaScript deleteCaption method
As in the previous section of JavaScript method example you have seen that we can add the caption to our table at execution time with the use of createCaption() method and in similar manner we can delete the caption of the table by calling the method deleteCaption().
- JavaScript deleteTFoot method
In the HTML table if we want to delete the table footer then we can delete this table footer by calling the JavaScript method with the table object.
- JavaScript deleteTHead method
As we can create and delete Table footer in the html page with the use of JavaScript method similarly we can delete and create Table header with the use of JavaScript method deleteTHead() of the table object.
- JavaScript dragDrop method
We can do lots of things with the JavaScript code instead of creating tables dynamically , adding and deleting table footers , showing alert message , client side validation and many more.
- JavaScript duplicate method
JavaScript's duplicate method creates a duplicate copy of the specified text range. In this example code we have called the duplicate method on the text range object to create a duplicate copy of that text and then it will be displayed through the alert() method.
- JavaScript elementFromPoint method
JavaScript method elementFromPoint returns the presented element at the specified coordinate position given in the arguments.
- JavaScript exp method
We can perform the mathematical calculations in the JavaScript by using the Math object reference. In Math object we have some very useful functions in which exp() is one important function generally used by the programmers.
- JavaScript floor method
JavaScript floor method is used to achieve the next complete number in the downward position.
- JavaScript focus method
JavaScript focus method can be used to set focus to the current window, to the input text box , to the specific button or to any radio button and many more elements.
- JavaScript fontColor method
We can also give different colors to the fonts by using the method fontColor() over any string instead of using the <font></font> tags. The fontcolor() method in JavaScript can be used to color strings in the specified format.
- JavaScript getAdjacentText method
JavaScript getAdjacentText method returns the text adjacent to the specified text element.
- JavaScript getAttribute method
JavaScript method getAttribute() is used to get the value of an attribute in an object. Most of the times it is used with the document.getElementById() method.
- JavaScript getAttributeNode method
This JavaScript method is used for getting the attribute node value. It can be used to retrieve the attribute node reference.
- JavaScript getData method
JavaScript method getData is used to get data in the specified format from the clipboard either via dataTransfer object or via the clipboardData object.
- JavaScript getElementById method
We can access the specific element of any existing html page by using the method getElementById(). For accessing any element in order to refer to it must have its some unique identity.
- JavaScript insertBefore method
In this section you will see that how we can insert new node or element before the referenced node as a child node of the current node and in it the current node will be act as the parent node.
- JavaScript insertCell method
JavaScript method insertCell can be used to insert a new cell to the table object's row element.
- JavaScript insertData method
JavaScript method insertData() can be used to insert some specific string value to the position which is specified by the user.
- JavaScript lastIndexOf method
JavaScript method lastIndexOf() is very much similar to the method indexOf() of the string object. It has only one difference that it searches for the very last occurrence of searching pattern and indexOf() method goes for the very first occurrence of searching pattern.
- JavaScript link method
JavaScript link method is used to create a hyperlink for any string. While we use the link method it creates hyperlink programmatically.
- JavaScript max method
If we have to compare some values then we can use the if-else statement but it will make our code more complex. Therefore instead of using the if-else statement we can use the max method of the Math object.
- JavaScript min method
As we can use the Math.max() method to find the maximum of zero or more values in the same way we can use Math.min() method to find the minimum of zero or more values.
- JavaScript namedItem method
This namedItem() method of JavaScript can be used to achieve the named items from the collection of elements. It takes the named item by the name or its id.
- JavaScript navigate method
In the JavaScript we have navigate() method which can help users to navigate to the various locations.
- JavaScript
setMonth() method
JavaScript setMonth() method is used to set month for the date object.
- JavaScript
scrollTo() method
This method of JavaScript scrolls content of the window to the specified coordinate position.
- JavaScript
scrollIntoView() method
This method scrollIntoView() is supported by both Internet Explorer and Firefox and can be a very useful method while applying scrolling property to HTML page, div or frame.
- JavaScript
scrollBy() method
JavaScript method scrollBy() can be used to scroll window by the provided number of pixels. One most important thing here to notice is that it can scroll windows only if the scrolling property is visible.
- JavaScript
resizeBy() method
We can resize window by using the method resizeBy(). It resizes the window into the specified pixels passed as parameters to this method.
- JavaScript reset() method
To illustrate reset() method of JavaScript we have created a simple HTML page into which we have created a form with the id "userform". Into this form we have taken two input fields "Name" and "Age".
- JavaScript
removeNode() method
Some times programmer may needs to remove some node according to their requirements while using JavaScript. There is a method removeNode() provided in JavaScript for removing nodes accordingly by getting its element's reference.
- JavaScript remove method
As JavaScript's add() method is used to add more option elements to the <select> tag. Similarly we can also remove option elements of the <select> tag by using the method remove() of the JavaScript.
- JavaScript removeAttribute method
JavaScript method removeAttribute() is used to remove attribute of an element. Most of the times it is used with the document.getElementById() method.
- JavaScript
pow() method
Some times programmers may need to evaluate the value by the power of some numbers therefore JavaScript provides an in-built function Math.pow().
- JavaScript parentElement method
JavaScript's parentElement() method returns reference to the parent element of the specified element. By using the parentElement() method.
- JavaScript open() method
Here is a case when this might be very useful. Suppose you are filling some information on the form and at that time you are required to perform some task on another page then either you have to click on browser to create new window or you may loose all information filled in that form.
- JavaScript
location.replace() method
JavaScript method location.replace(URL) immediately redirects to the specified URL location. After calling replace() method ,you cannot go back to the previous URL using browser's "Back" button.
- JavaScript hide() method
This function may be helpful when user wants to show some elements on any event and then required to hide them when action has been performed.
- JavaScript
getUTCDay() method
In JavaScript the method getUTCDay() returns a number between 0-6 inclusive and these numbers represent the day of the week according to the Universal Coordinated Time (UTC).
- JavaScript getUTCDate method
getUTCDate() method of JavaScript when applied to a date object returns an integer value between 1 and 31 that represents day from the date object's month.
- JavaScript getMilliseconds method
JavaScript method getMilliseconds() returns the milliseconds value in the Date object using the local time.
- JavaScript getFullYear method
JavaScript method getFullYear() returns present year. To illustrate getFullYear() method here we have created a button in the HTML page.
- JavaScript
removeAttributeNode() method
JavaScript's removeAttributeNode() method can be used as an alternate to the removeAttribute() method. It is used to remove attributes when you have a reference to the attribute object.
- JavaScript
setYear() method
We can use setYear() method of JavaScript to set year's value of a date object.
- JavaScript setUTCFullYear method
setUTCFullYear() method sets the full year for the provided date according to the Universal Coordinated Time (UTC).
- JavaScript setUTCDate method
JavaScript setUTCDate() method when applied to a date object it sets an integer value between 1 and 31 provided by the user that represents day of the date object's month.
- JavaScript setDate method
JavaScript setDate() method can be used to set a date value to the date object with an integer value between 1 and 31 that represents day of the current month.
- JavaScript setAttributeNode method
In JavaScript method setAttributeNode method is used to add a new attribute node to the specified element.
- JavaScript sup method
In the JavaScript, method sup() method is used to format text in superscript format. It makes a copy of that string and then embed it within <sup></sup> tags as in HTML.
- JavaScript submit method
In this part of JavaScript methods tutorial we are going to describe you the second way of form submission i.e. submitting form programmatically using the JavaScript method "submit()".
- JavaScript sub method
In the JavaScript, sub() method is used to format text in subscript format. It creates a copy of string and then embed it within <sub></sub> tags as in HTML.
- JavaScript strike method
JavaScript strike() method can be used to strikethrough the string. It converts the string in the format like "Hello".
- JavaScript
Math.sin() method
JavaScript's Math.sin() method returns mathematical sine of the number and it returns value between -1 to 1.
- JavaScript showModalDialog method
In JavaScript, showModalDialog() method creates a simple modal dialog box which is a simple html page but when a modal dialog opens, user can't switch to another page until it closes the modal dialog box.
- JavaScript toPrecision method
In JavaScript, toPrecision() method is used to convert a number into the number with the number of digits as provided for the precision.
- JavaScript add namespace
In this section, we are going to create the namespace using the JavaScript.
- JavaScript method anchor()
This section illustrates you the use of JavaScript anchor() method. The anchor() method creates an HTML anchor with a NAME attribute on the specified text.
- JavaScript method
AddFavourite()
This section illustrates you the use of JavaScript method AddFavorite(). This method can be used in Internet Explorer to add a web address or a redirected page to the Internet Explorer favorites.
- JavaScript method
atan()
This section illustrates you the use of JavaScript method atan(). The atan() method returns the arc tangent of a specified number as a numeric value between -PI/2 and PI/2 radians.
- JavaScript method big()
This section illustrates you the use of JavaScript method big(). The big() method allows you to display the specified string in a big font.
- JavaScript method
charCodeAt()
This section illustrates you the use of JavaScript method charCodeAt(). The charCodeAt() method returns the Unicode of the character at a specified position.
- JavaScript method
cos()
This section illustrates you the use of JavaScript method cos(). The method cos() returns the cosine of the specified number. It returns the numeric value between -1 and 1.
- JavaScript method
createTextRange()
This section illustrates the use of JavaScript method createTextRange(). In the given example, we are going to search a particular text from the specified text.
- JavaScript method
createElement()
This section illustrates you the use of JavaScript method createElement(). This method creates an instance of the element for the specified tag. It works only on Internet Explorer.
- JavaScript method
deleteRow()
This section illustrates you the use of JavaScript method deleteRow(). The deleteRow() method removes the row at the specified position from a table.
- JavaScript method
doScroll()
This section illustrates you the use of JavaScript method doScroll(). This method simulates a user action on a scroll bar component.
- JavaScript method
eval()
This section illustrates you the use of JavaScript method eval(). This function evaluates the string passed into the method and executes it.
- JavaScript method
fromCharCode()
This section illustrates you the use of JavaScript method fromCharCode(). The fromCharCode() method returns a readable string from the specified sequence of Unicode character values.
- JavaScript method
setFullYear()
setFullYear() method is used to set the full year for the specified date according to local time. In the given example, we have created a date object and specify date and time to it.
- JavaScript add row to table
This section illustrates you how to add a new row to the existing table using JavaScript.