WHAT A LAMP Rotating Header Image

Posts under ‘JavaScript’

tablesorter 2.0.3

Table Sorter is a very handy plugin of jQuery. It release 2.0.3. I use it in many web-based programs.  Let’s have a look on the features. tablesorter is a jQuery plugin for turning a standard HTML table with THEAD and TBODY tags into a sortable table without page refreshes. tablesorter can successfully parse and sort [...]

JavaScript Classes Comparison

There are more and more JavaScript Classes in front of programers. To choose one of the suitable is very important. Let me list some of them here: jQuery, Ext, MooTools, Prototype, YUI. Remy Sharp has gone through the jQuery and Prototype frameworks, which are probably the two closest to each other, and has done a [...]

Events Handling

By using JavaScript, we have the ability to create dynamic web pages. Events are actions that can be detected by JavaScript. Every element on a web page has certain events which can trigger JavaScript functions. For example, we can use the onClick event of a button element to indicate that a function will run when [...]

Loops of JavaScript

Loops in JavaScript are used to execute the same block of code a specified number of times or while a specified condition is true. JavaScript Loops Very often when you write code, you want the same block of code to run over and over again in a row. Instead of adding several almost equal lines [...]

Popup boxes

Popup boxes is used very often in Web developing. Alert Box An alert box is often used if you want to make sure information comes through to the user. When an alert box pops up, the user will have to click “OK” to proceed. Syntax: alert(“sometext”) Confirm Box A confirm box is often used if [...]

JavaScript Version

JavaScript from v1.1 to JavaScript 1.5. It is not big problem. Now, Javascript 1.5 is work smoothly on IE6.0 and Navigator 6.0. If you want to know which JavaScript version your browser support, you can download this html file and load it in your browser. Or you can run it by JavaScript Version Detector here. [...]

Date function in JavaScript

Return today’s date and time How to use the Date() method to get today’s date. The following code line defines a Date object called myDate: var myDate=new Date() Note: The Date object will automatically hold the current date and time as its initial value! In the example below we set a Date object to a [...]

Why use cookies

Cookies allow you to store information about a user’s visit on that user’s computer and retrieve it when the userrevisits your site. Two common reasons web developers use cookies are To idetify visitors You can detect when a user has previously visited your site and customize what that user sees on subsequent visits. To save [...]

Data types

There are two data types that JavaScript requires you to explicitly specify: the Array and Data data types. JavaScript supports the following data types: Array An ordered collection. For example: var animals = new Array (“cat”, “dog”, “mouse”) Boolean True/false data type (values of true or false only). For example: var cookieDetected = false var [...]

Make a Function

A function is a named group of JavaScript statements that you can declare once, near the top of your script, and call over and over again. Declaring a function function name ([parameter] [, parameter] [..., paramenter]){ statements return value } Call a function alert(“Total purchases come to ” + calculateTotal (10, 19.85)) Returning a value [...]