Home » Archive

Articles in the Javascript Category

HTML5, Javascript »

[24 Sep 2012 | No Comment | ]

In this tutorial we are going to see how to create and add an HTML5 Canvas element and apply style dynamically using javascript. We are going to use “createElement” method of document class to create HTML5 Canvas element dynamically.
Tutorial difficulty:

Basic Users

Related HTML5 tutorials:

HTML5 page structure without div
Detect iPad device orientation using HTML5
HTML5 tutorials

Dynamically create HTML5 Canvas Element:
We are going to dynamically create html5 canvas element using javascript. For this we have to use “createElement()” method of document class.
var canv = document.createElement(“canvas”);
canv.setAttribute(“id”, “canvasID”);
Here …

Javascript »

[12 Aug 2012 | No Comment | ]

Problem: Need to add back button in HTML which should take the user back in browser history.
Solution: We can use simple javascript “history.go(-1)” which points to back history in browser.
Let us discuss how to use in code.
Javascript History:
The History object contains an array of previously visited URLs by the visitor. history.back() takes user to back in the history.
Back button with inline JavaScript:
<input type=”button” value=”Go Back” onclick=”history.back(-1)” />
Above code displays simple button in browser which onClick takes user back to the history. history.back(-1) takes the user to previous page, “-1″ points …

Javascript, jQuery »

[10 Aug 2012 | No Comment | ]

We might have wanted to get URL of the current page in jQuery or to manipulate parts of the current page URL in jQuery. In this article we will discuss how to get URL of current page in jquery and also how to get parts of the url in jquery.
Tutorial difficulty:

Basic users
used: jQuery, HTML

In this article we will access the url of the current page using location object, location.href property holds the current page URL.

Window Location Object:
Each page path or the URL is referenced in window.location.href property, The location Objects …

Design, Javascript »

[1 Aug 2012 | No Comment | ]

Percentages are used to express how large/small one quantity is, relative to another quantity. Percentage Calculator is a simple online tool to calculate percentage,
let us see what is percentage.
What is percentage?

A rate, number, or amount in each hundred.
An amount, such as an allowance or commission, that is a proportion of a larger sum of money.

In mathematics, a percentage is a way of expressing a number, especially a ratio, as a fraction of 100. “Percent” comes from the latin Per Centum. The latin word Centum means 100.
It is often denoted using …

Javascript »

[22 May 2012 | No Comment | ]

Print is a method of javascript window Object which triggers the print function and opens the print window dialogue box in html page. We might have seen the “Print” option in most of the web pages which serves the same as above function.

Difficulty: Beginner

JavaScript window.print()
print is a simple and useful method of window Object in javascript to actually trigger the “File Print” combination.
We going to see how to implement javascript print in many ways.

javascript print on button Click:
Below is a simple code snippet to print a html …