Tag Archives: JavaScript
Closure in Javascript
Closure in JavaScript is a very typical concept and as I am writing this post, even I am not sure weather I can explain it properly or not. What I… Read more
How to remove a specific value from a javascript array
Here is a simple trick to remove a particular value from your array: // from this (6 items) var arr = ['remove', 'specific', 'value', 'from', 'javascript', 'array']; // to this… Read more
Removing All Spaces From a String Using Javascript
Here is a simple regular expression trick to remove all the spaces from a string using javascript: str = str.replace(/\s+/g,”); // where str is your original string Keep checking for… Read more
Identify the points of diagonal of a rectangle
This JavaScript will find the points of diagonal of a rectangle and draw a line on it. // display line between graph function drawLine( Ax, Ay, Bx, By) { Ax… Read more
Exception Handling In Javascript
There are various ways to handle exception in JavaScript. 1. try..catch..finally block function performDivision(x,y) { try { var z = x/y; return z; } catch(ex) { //raise error e The… Read more
Special character validation using JavaScript
Lets say you have a form, and you want to allow only certain special character for user to enter, then you should use special character validation. In my example, i… Read more
Script to populate Country/States using Javascript
Here is the script, few states names might be incorrect. Will correct them as soon as possible //Developers – Lokesh Lal //Vishal Gupta var countrylist = ‘Afghanistan|Albania|Andorra|Argentina|Armenia|Australia|Austria|Azerbaijan|Bahrain|Bangladesh|Belarus|Belgium|Belize|Bhutan|Bolivia|Bosnia 1|Bosnia 2|Brazil|Bulgaria|Cambodia|Canada|Chile|China|Colombia|Croatia|Cyprus 1|Cyprus… Read more
Reading Json in Javascript
To read JSON in JavaScript what all we need is eval operator var t = “{ user : [{name : ‘Lokesh’ , Age : ’26′ },{name : ‘Vishal’ , Age… Read more
Create FaceBook like Search Box
To create Facebook like search box, what all we need is css and JavaScript. Include the reference of JQuery in the page Create four arrays to hold the values of… Read more
Ajax POST method, using xmlhttprequest
To post data using ajax xmlhttp protocol. var request; function createAjax(url,callbackfunction,parameters,method) { try { request = new ActiveXObject(“Microsoft.XMLHTTP”) viagra vs cialis ; } catch(e1) { try { request = new… Read more
