Access options:

Really useful JavaScript functions

author: mike foskett incept: 4th October 2008

last update: 28th October 2011

Throughout this site I refer to my standard set of JavaScript functions. I think every developer has a set which they constantly reuse project to project. I thought I'd create a page outlining the ones I use. I hope you find them as useful as I do.

Each snippet is presented in long-hand easily readable form followed by a compressed single line version.

I strongly advise leaving in a credit to the original author along with a URL. You never know when you'll need the original article again, say for an update, and it's polite.

Damn those Crockford and Resig fellas, for making me code in a better manner. I've updated a few of the oldies and promoted them to the top. Older versions are now deprecated.

UK Postcode validation

author: john gardner 8th September 2011

This function checks the value of the parameter for a valid postcode format. The space between the inward part and the outward part is optional, although is inserted if not there as it is part of the official postcode.

If the postcode is found to be in a valid format, the function returns the postcode properly formatted (in capitals with the outward code and the inward code separated by a space. If the postcode is deemed to be incorrect a value of null is returned.

An example call for a form element with an id="postcode":


var postcode = checkPostCode(document.getElementById('postcode').value);
if (postcode) {
  document.getElementById('postcode').value = postcode;
  ... do stuff ...
} else {
  alert("Valid UK post code required");
}

Updated original version was run through JSLint prior to upload and compression.


// UK Postcode validation - John Gardner - http://www.braemoor.co.uk/software/postcodes.shtml
function checkPostCode(toCheck) {
  var alpha1 = "[abcdefghijklmnoprstuwyz]",
    alpha2 = "[abcdefghklmnopqrstuvwxy]",
    alpha3 = "[abcdefghjkpmnrstuvwxy]",
    alpha4 = "[abehmnprvwxy]",
    alpha5 = "[abdefghjlnpqrstuwxyz]",
    pcexp = [],
    postCode = toCheck,
    valid = false,
    i;
  pcexp.push(new RegExp("^(" + alpha1 + "{1}" + alpha2 + "?[0-9]{1,2})(\\s*)([0-9]{1}" + alpha5 + "{2})$", "i"));
  pcexp.push(new RegExp("^(" + alpha1 + "{1}[0-9]{1}" + alpha3 + "{1})(\\s*)([0-9]{1}" + alpha5 + "{2})$", "i"));
  pcexp.push(new RegExp("^(" + alpha1 + "{1}" + alpha2 + "{1}" + "?[0-9]{1}" + alpha4 + "{1})(\\s*)([0-9]{1}" + alpha5 + "{2})$", "i"));
  pcexp.push(/^(GIR)(\s*)(0AA)$/i);
  pcexp.push(/^(bfpo)(\s*)([0-9]{1,4})$/i);
  pcexp.push(/^(bfpo)(\s*)(c\/o\s*[0-9]{1,3})$/i);
  pcexp.push(/^([A-Z]{4})(\s*)(1ZZ)$/i);
  pcexp.push(/^(ai-2640)$/i);
  for (i = 0; i < pcexp.length; i++) {
    if (pcexp[i].test(postCode)) {
      pcexp[i].exec(postCode);
      postCode = RegExp.$1.toUpperCase() + " " + RegExp.$3.toUpperCase();
      postCode = postCode.replace(/C\/O\s*/, "c/o ");
      if (toCheck.toUpperCase() === 'AI-2640') {
        postCode = 'AI-2640';
      }
      valid = true;
      break;
    }
  }
  return valid ? postCode : null;
}

Short form:


// UK Postcode validation - John Gardner - http://www.braemoor.co.uk/software/postcodes.shtml
function checkPostCode(I){var A="[abcdefghijklmnoprstuwyz]",B="[abcdefghklmnopqrstuvwxy]",C="[abcdefghjkpmnrstuvwxy]",D="[abehmnprvwxy]",E="[abdefghjlnpqrstuwxyz]",G=[],H=I,J=false,F;G.push(new RegExp("^("+A+"{1}"+B+"?[0-9]{1,2})(\\s*)([0-9]{1}"+E+"{2})$","i"));G.push(new RegExp("^("+A+"{1}[0-9]{1}"+C+"{1})(\\s*)([0-9]{1}"+E+"{2})$","i"));G.push(new RegExp("^("+A+"{1}"+B+"{1}?[0-9]{1}"+D+"{1})(\\s*)([0-9]{1}"+E+"{2})$","i"));G.push(/^(GIR)(\s*)(0AA)$/i);G.push(/^(bfpo)(\s*)([0-9]{1,4})$/i);G.push(/^(bfpo)(\s*)(c\/o\s*[0-9]{1,3})$/i);G.push(/^([A-Z]{4})(\s*)(1ZZ)$/i);G.push(/^(ai-2640)$/i);for(F=0;F<G.length;F++){if(G[F].test(H)){G[F].exec(H);H=RegExp.$1.toUpperCase()+" "+RegExp.$3.toUpperCase();H=H.replace(/C\/O\s*/,"c/o ");if(I.toUpperCase()==="AI-2640"){H="AI-2640";}J=true;break;}}return J?H:null;}

For further details, including annotated code, please see the original article: Validating UK post codes. Which also includes PHP and VBScript versions too.

Get elements by class name: $elsByClassName()

author: mike foskett uploaded: 16th July 2010

Requires $id(), $els(), hasClass():


function $elsByClassName(id, element, classname) {
  // returns a list of objects of element.classname or false.
  // results are cached so function is useless for detecting changed classes, e.g. class="on".
  var a = [], i, obj, pointer;
  element = element || "*";
  pointer = id + element + classname;
  if ($elsByClassName.cache[pointer] === undefined) { // get a result the long way round
    $elsByClassName.cache[pointer] = false; // cache negative result too
    if ($id(id) && classname) {
      obj = $els(id, element); // this result is cached separately
      i = obj.length;
      while (i--) {
        if (hasClass(obj[i], classname)) {
          a.push(obj[i]);
        }
      }
      if (a.length) {
        $elsByClassName.cache[pointer] = a.reverse(); // cache it for next time
      }
    }
  }
  return $elsByClassName.cache[pointer];
}
$elsByClassName.cache={}; // create global property

Short form:


function $elsByClassName(id,e,c){var a=[],i,o,p;e=e||"*";p=id+e+c;if($elsByClassName.cache[p]===undefined){$elsByClassName.cache[p]=false;if($id(id)&&c){o=$els(id,e);i=o.length;while(i--){if(hasClass(o[i],c)){a.push(o[i]);}}if(a.length){$elsByClassName.cache[p]=a.reverse();}}}return $elsByClassName.cache[p];}
$elsByClassName.cache={};

Controlling classes: hasClass(), removeClass(), addClass()

author: uploaded: 16th July 2011

Using regular expressions:


function hasClass(obj, c) {
  return new RegExp('(\\s|^)' + class + '(\\s|$)').test(obj.className);
}

function addClass(obj, class) {
  if (!hasClass(obj, class)) {
    obj.className += ' ' + class;
  }
}

function removeClass(obj, class) {
  if (hasClass(obj, class)) {
    obj.className = obj.className.replace(new RegExp('(\\s|^)' + class + '(\\s|$)'), ' ').replace(/\s+/g, ' ').replace(/^\s|\s$/, '');
  }
}

Acts exactly as you'd wish, especially the removeClass() which removes leading and trailing spaces. It nicely removes a centered class too

Short form:


function hasClass(o,c){return new RegExp('(\\s|^)'+c+'(\\s|$)').test(o.className);}
function addClass(o,c){if(!hasClass(o,c)){o.className+=' '+c;}}
function removeClass(o,c){if(hasClass(o,c)){o.className=o.className.replace(new RegExp('(\\s|^)'+c+'(\\s|$)'),' ').replace(/\s+/g,' ').replace(/^\s|\s$/,'');}}

Further details: .

Shorten document.getElementById (version 2) - $id()

author: mike foskett uploaded: 4th October 2008

updated: 16th July 2011

Saves repeatedly writing out document.getElementById('idname'):


function $id(id) {
  if ($id.cache[id] === undefined) {
    $id.cache[id] = document.getElementById(id) || false;
  }
  return $id.cache[id];
}
$id.cache = {};

Results are cached which speeds up repeat requests by 50%.

Short form:


function $id(i){return $id.cache[i]===undefined?$id.cache[i]=document.getElementById(i)||false:$id.cache[i];}
$id.cache={};

Get collection of elements (version 2) - $els()

Author: mike foskett uploaded: 5th April 2011

updated: 16th July 2011

Simplifies:


var obj = document.getElementbyId('idName');
if (obj) {
  var divElements = obj.getElementsByTagName('div');
  if (divElements.length > 0) {
    for (var i = 0; i < divElements.length; i += 1) {
      // do stuff with divElements[i] etc
    }
  }
}

Into:


var divElements = $els('idName', 'div');
var i = divElements.length;
while (i--) {
  // do stuff with divElements[i] etc
}

Or:


if (els('idname','div')){
  // do stuff with els('idname','div')[0] etc
}

Returns the list of elements if it's > 0, or a boolean false.

The beauty is the results from $els() are cached so repeat requests are 50% faster.

Function in full:


function $els(id, el) {
  var a = id + el, obj;
  if ($els.cache[a] === undefined) {
    obj = document.getElementById(id);
    if (obj) {
      $els.cache[a] = obj.getElementsByTagName(el || "*") || false;
    } else {
      $els.cache[a] = false;
    }
  }
  return $els.cache[a];
}
$els.cache = {};

Short form:


function $els(i,e){var a=i+e,o;if($els.cache[a]===undefined){o=document.getElementById(i);if(o){$els.cache[a]=o.getElementsByTagName(e||"*")||false;}else{$els.cache[a]=false;}}return $els.cache[a];}
$els.cache={};

Title case / capitalize text string

author: media college uploaded: 17th December 2010

Converts the first letter of each word in a string to a capital letter:


String.prototype.capitalize = function() {
  return this.replace( /(^|\s)([a-z])/g , function(m,p1,p2){return p1+p2.toUpperCase();});
};

Usage:


textString.capitalize();

Note it does not convert the other letters to lowercase so in practice it may be better to:


textString.toLowerCase().capitalize();

Short form:


String.prototype.capitalize=function(){return this.replace(/(^|\s)([a-z])/g,function(m,p1,p2){return p1+p2.toUpperCase();});};

Full details see: Capitalize Words Using JavaScript

Simple is IE test

uploaded: 9th July 2010

A very simple IE boolean test found on the net:


var isIE = /*@cc_on!@*/false;

Returns true if you're using any version of IE, otherwise false.

Cross-browser mouseenter and mouseleave

author: sstchur uploaded: 1st June 2010

A cross browser script to emulate IE's mouseenter / mouseleave functions. these functions do not use event bubbling. The original article didn't supply a minified example:


// Cross-browser mouseenter and mouseleave, without event bubbling - http://blog.stchur.com/2007/03/15/mouseenter-and-mouseleave-events-for-firefox-and-other-non-ie-browsers/
var xb={eH:[],
uID:function(_e){if(_e===window){return 'theWindow';}else if(_e===document){return 'theDocument';}else {return _e.uniqueID;}},
addEvent:function(_e,_eN,_fn,_uC){if(typeof _e.addEventListener!='undefined'){if(_eN=='mouseenter'){_e.addEventListener('mouseover',xb.mouseEnter(_fn),_uC);}else if(_eN=='mouseleave'){_e.addEventListener('mouseout',xb.mouseEnter(_fn),_uC);}else{_e.addEventListener(_eN,_fn,_uC);}}else if(typeof _e.attachEvent!='undefined'){var key='{FNKEY::obj_'+xb.uID(_e)+'::evt_'+_eN+'::fn_'+_fn+'}',f=xb.eH[key];if(typeof f!='undefined'){return;}f=function(){_fn.call(_e);};xb.eH[key]=f;_e.attachEvent('on'+_eN,f);window.attachEvent('onunload',function(){_e.detachEvent('on'+_eN,f);});key=null;}else{_e['on' + _eN]=_fn;}},
removeEvent:function(_e,_eN,_fn,_uC){if(typeof _e.removeEventListener!='undefined'){_e.removeEventListener(_eN,_fn,_uC);}else if(typeof _e.detachEvent!='undefined'){var key='{FNKEY::obj_'+xb.uID(_e)+'::evt'+_eN+'::fn_'+_fn+'}';var f=xb.eH[key];if(typeof f!='undefined'){_e.detachEvent('on'+_eN,f);delete xb.eH[key];}key=null;}},
mouseEnter:function(_pFn){return function(_evt){var rT=_evt.relatedTarget;if(this==rT || xb.isAChildOf(this,rT)){return;}_pFn.call(this,_evt);};},
isAChildOf:function(_parent,_child){if(_parent==_child){return false;}while(_child && _child!=_parent){_child=_child.parentNode;}return _child==_parent;}
};

Useage:


xb.addEvent(obj, 'mouseenter', enter(e), false);
xb.addEvent(obj, 'mouseleave', leave(e), false);

function enter(e){
  alert('mouseenter: ' + this.id);
}

function leave(e){
  alert('mouseleave: ' + this.id);
}

Further details: Mouseenter and mouseleave events for Firefox (and other non-IE browsers).

Strip anchor from URL

author: mike foskett uploaded: 20th May 2010

Strips out just the anchor from a URL string:


function getAnchorFromURI(uri) {
  return uri.slice(uri.lastIndexOf('#') + 1);
}

Short form:


function getAnchorFromURI(u){return u.slice(u.lastIndexOf('#')+1);}

Regex form validation functions

uploaded: 18th May 2010

Form validation functions using regex. Each returns a boolean either true or false.


function isInteger(str) { // positive or negative integer without range check.
  return (/^-?\d+$/.test(str));
}

function isPositiveDecimal(str) { // positive only, integer or decimal point.
  return (!/\D/.test(str)) || (/^\d+\.\d+$/.test(str));
}

function isAlphanumeric(str) { // [a-z],[A-Z],[0-9] only
  return !(/\W/.test(str));
}

function isAlphanumericSpaceAmpersandHyphen(str) { // [a-z],[A-Z],[0-9], ,&,-] only
  return !(/^[\w &\-]+$/.test(str));
}

function validEmail(str) {
  return str.match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/) ===  null;
}

Please inspect the test cases prior to using these functions:

Function Test cases
abc & - ab1 12a 123 -123 1.23 -1.2 "" " " NULL
isInteger False False False False False True True False False False False False
isPositiveDecimal False False False False False True False True False True False False
isAlphanumeric True False False True True True False False False True False True
isAlphanumeric
Plus: " ","&", "-"
True True True True True True True False False False True True

Note: Pay particular attention to the empty string and null results.

Short form:


function isInteger(s){return (/^-?\d+$/.test(s));}
function isPositiveDecimal(s){return (!/\D/.test(str))||(/^\d+\.\d+$/.test(s));}
function isAlphanumeric(str){return !(/\W/.test(s));}
function isAlphanumericSpaceAmpersandHyphen(s){return !(/^[\w &\-]+$/.test(s));}
function validEmail(s){return s.match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/)===null;}

Cross-browser setting the style attribute

author: tyler waters uploaded: 25th March 2010

IE doesn't play well with setAttribute. Here's a simple cross-browser method for setting a style attribute on an object:


function setStyle(obj, styleStr) {
  obj.setAttribute('style', styleStr);
  obj.style.cssText = styleStr;
}

Short form:


function setStyle(o,s){o.setAttribute('style',s);o.style.cssText=s;}

Though ideally the methods should be tested for before usage.

Further details: setAttribute does not work when used with the style attribute.

Switching input auto-complete off

author: mike foskett uploaded: 20th February 2010

Auto complete is a proprietary Microsoft attribute, and deemed invalid in XHTML, but widely supported by most browsers. Very useful for private fields on public machines.


document.getElementById('inputID').setAttribute("autocomplete", "off");

Note the method described requires JavaScript to be of any use.

Cross browser viewport width & height

author: mike foskett uploaded: 4th February 2010

Requires isLessThanIE() function

Short form:


var w=isLessThanIE(8)?(!(document.documentElement.clientWidth)||(document.documentElement.clientWidth===0))?document.body.clientWidth:document.documentElement.clientWidth:window.innerWidth;
var h=isLessThanIE(8)?(!(document.documentElement.clientHeight)||(document.documentElement.clientHeight===0))?document.body.clientHeight:document.documentElement.clientHeight:window.innerHeight;

Based on: Find viewport height / width, crossbrowser.

Cross browser whole document width & height

author: cody lindley uploaded: 2nd November 2006

Gets the width and height of the whole document including the area offscreen.

Short form:


var docH=(document.height!==undefined)?document.height:document.body.offsetHeight;
var docW=(document.width!==undefined)?document.width:document.body.offsetWidth;

Further details: Javascript Get Page Height With Scroll.

I recently had issue with Firefox and the height calculation. Consequently I found a new function to generate page height:

author: james padolsey uploaded: 7th January 2011


function getDocHeight(){var D=document;return Math.max(Math.max(D.body.scrollHeight,D.documentElement.scrollHeight),Math.max(D.body.offsetHeight,D.documentElement.offsetHeight),Math.max(D.body.clientHeight,D.documentElement.clientHeight));}

Original article: Get document height (cross-browser).

Using wrap on an XHTML textarea

author: bob ince uploaded: 28th January 2010

Wrap is a deprecated attribute in XHTML but occasionally you still need to switch it:


function setWrap(area, wrap) {
  if (area.wrap) {
    area.wrap = wrap;
  } else { // wrap attribute not supported - try Mozilla workaround
    area.setAttribute('wrap', wrap);
    var newarea = area.cloneNode(true);
    newarea.value = area.value;
    area.parentNode.replaceChild(newarea, area);
  }
}

Pass in the textarea object and wrap state

Short form:


function setWrap(a,w){if(a.w){a.w=w;}else{a.setAttribute('wrap',w);var n=a.cloneNode(true);n.value=a.value;a.parentNode.replaceChild(n,a);}}

Example: Switch wrap off on a textarea with id="ta"


setWrap(document.getElementById('ta'), "off");

It is best to back this with a little CSS too:


textarea {white-space:pre; overflow:auto}

Further details: Changing textarea wrapping using javascript.

IE version test - isLessThanIE(version)

author: mike foskett 21st January 2010

Not a recommended method but, on rare occasion, incredibly useful.


function isLessThanIE(version) {
  if (navigator.appName === 'Microsoft Internet Explorer') {
    var ua = navigator.userAgent,
      re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) !== null) {
      if (parseFloat(RegExp.$1) < version) {
        return true;
      }
    }
  }
  return false;
}

Short form version:


function isLessThanIE(v){if(navigator.appName=='Microsoft Internet Explorer'){var u=navigator.userAgent,r=new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");if(r.exec(u)!==null){if(parseFloat(RegExp.$1)<v){return true;}}}return false;}

Integer validation - isInteger(str)

author: mike foskett 21st January 2010

Tests a string contains only numeric characters (0 - 9) using a regular expression. The string may start with a minus (-). The integer value is not range checked. Primarily used for form input validation.


function isInteger(str) {
  return (/^-?\d+$/.test(str));
}

Short form version:


function isInteger(s){return(/^-?\d+$/.test(s));}

Alternate, positive only, version:


function isPositiveInteger(s){return(/^\d+$/.test(s));}

Faster for-next looping

author: mike foskett 23rd October 2009

Only use if you're trawling through many objects in the DOM, use a fast for-next loop. Replace:


var allDivs=document.getElementsByTagName('div');
for (var i=0; i<allDivs.length; i++){
  // do stuff with every div
}

With:


var allDivs = document.getElementsByTagName('div');
for (var i = allDivs.length-1; i > -1; i--) {
  // do stuff with every div
}

The method is faster because there are less calculations on each iteration. The loop works backwards though. That is it starts from the top limit (allDivs.length-1) down to 0.

Optionally you could use a while loop, which may be quicker:


var allDivs = document.getElementsByTagName('div'),
    i = allDivs.length;
while (i--) {
  // do stuff with every div
}

Accessible pop-up window link using an inline script

author: mike foskett 13th October 2009

updated: 24th March 2010

Not an advised technique but sometimes very useful.


<p>
  <a onclick="var w=620,h=350,newWindow=window.open(this.href,'newWin','resizable,toolbar=0,location=0,scrollbars=1,menubar=0,width='+w+',height='+h+',top='+(screen.height-h)/2+',left='+(screen.width-w)/2+'');newWindow.focus();return false;" href="tandc.html" title="Open's in a new window">Terms and conditions</a>
</p>

This version:

  • Gets content from href address.
  • Allows a fixed width and height.
  • Places the window screen centre.
  • Adds focus to the window so it always comes to the front.
  • Content available without JavaScript.

Last update repaired screen centring issue.

Simple closure space example

author: mike foskett 13th October 2009

A simple closure used to encapsulate JavaScript functions. Useful and advisable if you work on large sites with complex JavaScript includes as it helps prevent unwanted interactions.


var closureSpace=function(){

  function init() {
    ...
  }

  return{ // list externally available functions here
    init:init
  };

}();

closureSpace.init(); // call externally available function like this

Is CSS available? hasCSS()

author: mike foskett 13th October 2009

A small function to test that CSS is on and available. Used to prevent Javascript functions acting on styles when their already off, unavailable, or not supported.

It works by adding a hidden div to the end of the document and testing its display property.

The function returns a boolean. I found it best to set a global variable to that result for use.


var cssOn; // Global variable

function hasCSS() {
  var d, o, v = false;
  // add a new div to the end of the body.
  d = document.createElement('div');
  d.id = "hasCSS";
  document.body.appendChild(d);

  // test new div display property (set in css).
  o = document.getElementById("hasCSS");
  if (window.getComputedStyle) {
    v = (window.getComputedStyle(o, null).getPropertyValue('display') === 'none');
  } else {
    if (o.currentStyle) {
      v = (o.currentStyle.display === 'none');
    }
  }

  // remove div.
  document.body.removeChild(d);

  // return test result.
  return v;
}

// run first on page load using addLoadEvent found elsewhere on this page.
addLoadEvent(function() {cssOn = hasCSS();});

The Short form version:


function hasCSS(){var d=document.createElement('div');d.id="hasCSS";document.body.appendChild(d);var o=document.getElementById("hasCSS"),v=false;if(window.getComputedStyle){v=(window.getComputedStyle(o,null).getPropertyValue('display')==='none');}else{if(o.currentStyle){v=(o.currentStyle.display==='none');}}document.body.removeChild(d);return v;}
// run once on page load (use addLoadEvent or similar function)
var cssOn=hasCSS();

Somewhere in the style sheet this is required:


#hasCSS {display:none}

To use the function:


if (cssOn) {
  ...
}

Cross-browser getNextSibling()

author: mike foskett 8th January 2009

Firefox and IE see things differently when accessing the nextSibling. This function balances those differences to provide a simple cross-browser solution:


function getNextSibling(obj) {
  var next = obj.nextSibling;
  while (next.nodeType !== 1) {
    next = next.nextSibling;
  }
  return next;
}

The Short form version:


function getNextSibling(o){var n=o.nextSibling;while(n.nodeType!=1){n=n.nextSibling;}return n;}

An example of usage. Show a hidden div which is the next sibling to a links parent:


.show {display:block}
.hide {display:none}

<h3>
  <a href="#" onclick="getNextSibling(this.parentNode).className='show'; return false">Show div content</a>
</h3>
<div class="hide">
...
</div>

Launch a new window in XHTML strict

author: mike foskett uploaded: 10th October 2008

updated: 13th September 2010

After dealing with pages which contained hundreds of links I thought it judicial to update the function to use the fastest loop method. The code has also been verified by JSLint. 28th March 2009

Add rel="external" to each external link:


<a href="someAddress.html" rel="external">external link to some page</a>

Then JavaScript unobtrusively adds a target to each link marked by rel="external". A title is also added to each link informing the user that it opens in a new window:


// Links with rel="external" get launched into new window
function externalLinks() {
  var links, i, A;
  links = document.getElementsByTagName("a");
  i = links.length;
  while (i--) {
    A = links[i];
    if (A.getAttribute("href") && A.getAttribute("rel") === "external") {
      A.target = "_blank";
      A.title = (A.title !== "") ? A.title + " (launches in a new window)" : "Launches in a new window";
    }
  }
}

Short form:


// Links with rel="external" get launched into new window
function externalLinks(){var L,i,A;L=document.getElementsByTagName("a");i=L.length;while(i--){A=L[i];if(A.getAttribute("href")&&A.getAttribute("rel")==="external"){A.target="_blank";A.title=(A.title!=="")?A.title+" (launches in a new window)":"Launches in a new window";}}}

Latest update removed: A.onclick=function(){return false;}; which overwrote the href action - Doh!

Executing JavaScript on page load - addLoadEvent()

author: simon willisons 26th May 2004

A beautiful onload handler which allows multiple functions to be run once the page has loaded:


function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload !== 'function') {
    window.onload = func;
  } else {
    window.onload = function () {
      if (oldonload) {
        oldonload();
      }
      func();
    };
  }
}

addLoadEvent(nameOfSomeFunctionToRunOnPageLoad);
addLoadEvent(function () {
  // more code to run on page load
});

Here's the short form version:


// author: Simon Willisons - http://simonwillison.net/2004/May/26/addLoadEvent/
function addLoadEvent(f){var o=window.onload;if(typeof window.onload!=='function'){window.onload=f;}else{window.onload=function(){if(o){o();}f();};}}

Further details: Executing JavaScript on page load.

Separation of CSS and JavaScript - jsCSS()

author: christian heilmann uploaded: 4th October 2008

Avoid using JavaScript for presentational effects. Use this function to swap, add, remove, check or toggle a class name.

Original modified to include a class toggle switch:


// className: swap, add, remove, check or toggle - author: Christian Heilmann - http://www.onlinetools.org/articles/unobtrusivejavascript/cssjsseparation.html
function jsCSS(action, obj, class1, class2) {
  var rep;
  switch (action) {
  case 'swap':
    obj.className = !jsCSS('check', obj, class1) ? obj.className.replace(class2, class1) : obj.className.replace(class1, class2);
    break;
  case 'add':
    if (!jsCSS('check', obj, class1)) {obj.className += obj.className ? ' ' + class1 : class1; }
    break;
  case 'remove':
    rep = obj.className.match(' ' + class1) ? ' ' + class1 : class1;
    obj.className = obj.className.replace(rep, '');
    break;
  case 'check':
    return new RegExp('\\b' + class1 + '\\b').test(obj.className);
  case 'toggle':
    if (jsCSS('check', obj, class1)) {
      jsCSS('remove', obj, class1);
    } else {
      jsCSS('add', obj, class1);
    }
    break;
  }
}

Short form:


// jsCSS(action,object,class1,class2) -  className: swap, add, remove, check or toggle - author: Christian Heilmann - http://www.onlinetools.org/articles/unobtrusivejavascript/cssjsseparation.html
function jsCSS(a,o,c1,c2){switch(a){case'swap':o.className=!jsCSS('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2);break;case'add':if(!jsCSS('check',o,c1)){o.className+=o.className?' '+c1:c1;}break;case'remove':var rep=o.className.match(' '+c1)?' '+c1:c1;o.className=o.className.replace(rep,'');break;case'check':return new RegExp('\\b'+c1+'\\b').test(o.className);case'toggle':if(jsCSS('check',o,c1)){jsCSS('remove',o,c1);}else{jsCSS('add',o,c1);}break;}return false;}

Further details: Separation of CSS and JavaScript.

Check an id exists - idExists()

author: mike foskett uploaded: 4th October 2008

Check an id actually exists prior to using it:


function $idExists(id) {
  return (document.getElementById(id) !== null);
}

Short form requires the $id() function too:


function $idExists(i){return(document.getElementById(i)!==null);}

Affecting styles before JavaScript is loaded - .hasJS

author: mike foskett uploaded: 4th October 2008

Add this snippet directly after the page title and it adds a class of .hasJS to the html element if JavaScript is present. It allows the style sheet to style components used by JavaScript before the page fully loads:


<script type="text/javascript">/*<![CDATA[*/document.documentElement.className="hasJS";/*]]>*/</script>

Which means the style sheet can act on any styles affected by the JavaScript prior to loading the JavaScript. For instance; consider hiding a block only when JavaScript is available:


.hasJS .hide {display:none}

Check DOM functions are supported - isDom()

author: mike foskett uploaded: 4th October 2008

It's always best to test that the DOM functions you wish to use are supported prior to using them. Extend or abbreviate as required:


function isDom() {
  return (
    document.getElementById
    && document.getElementsByTagName
    && document.createElement
  ) ? true : false;
}

Short form:


function isDom(){return (document.getElementById&&document.getElementsByTagName&&document.createElement)?true:false}

This function should be called first, before any other scripting. All JavaScript should degrade gracefully and, personally, if the functions I use are not supported then I do not deliver any script at all. For example:


if (isDom()){
  addLoadEvent(setup);
}

Setting opacity cross-browser - setOpacity()

author: mike foskett uploaded: 4th October 2008

updated: 5th April 2011

Setting the opacity level of an object is not yet a standard. The following snippet irons out cross-browser inconsistencies:

This update tests the object exists prior to setting it's opacity.

Original id based version:


function setOpacity(id, opacity) {
  var object = document.getElementById(id).style;
  if (object) {
    object.filter = "alpha(opacity=" + opacity + ")";
    object.opacity = opacity / 100;
    object.MozOpacity = opacity / 100;
    object.KhtmlOpacity = opacity / 100;
  }
}

Short form requires $id():


function setOpacity(id,op){var o=$id(id).style;if(o){o.opacity=op/100;o.MozOpacity=op/100;o.KhtmlOpacity=op/100;o.filter="alpha(opacity="+op+")";}}

The function may be called via a timed loop for fading purposes. This example fades in an object with an id of idname:


for (var i = 0; i < 101; i += 25) {
  setTimeout("setOpacity('idname', " + i + ")", i*2);
}

Updated object based version:

author: mike foskett uploaded: 21st January 2010

This version has no prerequisites and includes method checking.


function setOpacity(obj, xOpacity) {
  if (typeof obj.style.MozOpacity !== "undefined") {
    obj.style.MozOpacity = xOpacity;
  } else {
    if (typeof obj.style.opacity !== "undefined") {
      obj.style.opacity = xOpacity;
    } else {
      if (typeof obj.style.filter !== "undefined") {
        obj.style.filter = "alpha(opacity=" + xOpacity * 100 + ")";
      }
    }
  }
}

Short form:


function setOpacity(o,op){if(typeof o.style.MozOpacity!=="undefined"){o.style.MozOpacity=op;}else{if(typeof o.style.opacity!=="undefined"){o.style.opacity=op;}else{if(typeof o.style.filter!=="undefined"){o.style.filter="alpha(opacity="+op*100+")";}}}}

Convert CSS property to camel case - hyphenToCamel()

author: steffen rusitschka uploaded: 4th October 2008

:


function hyphenToCamel(s) {
  var exp;
  for (exp = /-([a-z])/; exp.test(s); s = s.replace(exp, RegExp.$1.toUpperCase())) {}
  return s;
}
function hyphenToCamel(s){var E;for(E=/-([a-z])/;E.test(s);s=s.replace(E,RegExp.$1.toUpperCase())){}return s;}

Short form version is pretty much the same:


// author: Steffen Rusitschka - http://www.ruzee.com/blog/2006/07/retrieving-css-styles-via-javascript/
function hyphenToCamel(s){var E;for(E=/-([a-z])/;E.test(s);s=s.replace(E,RegExp.$1.toUpperCase())){}return s;}

Further details: Retrieving CSS styles via JavaScript.

Retrieving CSS properties with JavaScript - getStyleProperty()

author: mike foskett uploaded: 4th October 2008

Cross-browser method to obtain a CSS property

Please note this function is not 100% for retrieving all CSS properties but does work on most of them. Function requires hyphenToCamel():


function getStyleProperty(id, property) {
  // note this function is not 100% generic for all CSS properties
  var obj = document.getElementById(id),
    value = '';
  if (window.getComputedStyle) {
    value = window.getComputedStyle(obj, null).getPropertyValue(property);
  } else {
    if (obj.currentStyle) {
      value = obj.currentStyle[hyphenToCamel(property)];
    }
  }
  return value;
}

Short form requires both hyphenToCamel() and $id():


function getStyleProperty(i,P){var o=document.getElementById(i),V='';if(window.getComputedStyle){V=window.getComputedStyle(o,null).getPropertyValue(P);}else{if(o.currentStyle){V=o.currentStyle[hyphenToCamel(P)];}}return V;}

Further details: Retrieving CSS styles via JavaScript.

Test for Flash - isFlash()

author: mike foskett uploaded: 4th October 2008

updated: 20th May 2009

The function simply tests what version of Flash is available to the clients browser. Call the function with the minimum Flash version required eg: isFlash(7) and it returns false if unsupported or the supported Flash version eg 9:

Unfortunately I've lost the original reference for this script.


function isFlash(v){
  var testTo=20, installed=0, x;
  if(navigator.plugins && navigator.plugins.length){
    for(x=0;x<navigator.plugins.length;x++){
      if(navigator.plugins[x].name.indexOf('Shockwave Flash')!=-1){
        installed=parseInt(navigator.plugins[x].description.split('Shockwave Flash ')[1],10);
        break;
  } } }
  else if(window.ActiveXObject){
    for(x=2;x<=testTo;x++){
      try{if(eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+x+"');")){installed=x;}}
      catch(e){}
  } }
  return((installed>=v)?installed:0);
}

Short form:


function isFlash(v){var t=20,i=0,c;if(navigator.plugins&&navigator.plugins.length){for(c=0;c<navigator.plugins.length;c++){if(navigator.plugins[c].name.indexOf('Shockwave Flash')!=-1){i=parseInt(navigator.plugins[c].description.split('Shockwave Flash ')[1],10);break;}}}else if(window.ActiveXObject){for(c=2;c<=t;c++){try{if(eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+c+"');")){i=c;}}catch(e){}}}return((i>=v)?i:0);}

Quickly replace content - replaceContent()

author: mike foskett uploaded: 4th October 2008

Replaces the content of an object referenced by it's id. Okay it uses innerHTML but tests have shown that it's fully supported by all browsers and executes quicker than DOM compliant methods:


function replaceContent(id, content) {
  if (idExists(id)) {
    document.getElementById(id).innerHTML = content;
  }
}

Short form requires $id():


function replaceContent(id,c){if(idExists(id)){$id(id).innerHTML=c;}}

Cookie handling

author: peter-paul koch - uploaded: 4th October 2008

Create, and read from, cookies:


function makeCookie(name, value, days) {
  var expires = "", date;
  if (days) {
    date = new Date();
    date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
    expires = "; expires=" + date.toGMTString();
  }
  document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=",
    ca = document.cookie.split(';'),
    i,
    c;
  i = ca.length;
  while (i--) {
    c = ca[i];
    while (c.charAt(0) === ' ') {
      c = c.substring(1, c.length);
    }
    if (c.indexOf(nameEQ) === 0) {
      return c.substring(nameEQ.length, c.length);
    }
  }
  return null;
}

function killCookie(name) {
  makeCookie(name, '', -1);
}

Short form:


// Cookie functions - Peter-Paul Koch: http://www.quirksmode.org/js/cookies.html
function makeCookie(N,V,D){var E="",A;if(D){A=new Date();A.setTime(A.getTime()+(D*24*60*60*1000));E="; expires="+A.toGMTString();}document.cookie=N+"="+V+E+"; path=/";}
function readCookie(N){var E=N+"=",C=document.cookie.split(';'),i,c;i=C.length;while(i--){c=C[i];while(c.charAt(0)===' '){c=c.substring(1,c.length);}if(c.indexOf(E)===0){return c.substring(E.length, c.length);}}return null;}
function killCookie(N){makeCookie(N,'',-1);}

Further details: Cookies.

Replace content via Ajax

author: jim ley - January 2006

I cannot honestly say I understand Jim's code here but it works very well:


// XMLHttpRequest methods - author Jim Ley - http://jibbering.com/2002/4/httprequest.html
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version>=5)
    try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")}
    catch(e){
      try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}
      catch(E){xmlhttp=false}
    }
  @else
    xmlhttp=false;
  @end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined'){
  try{xmlhttp=new XMLHttpRequest()}
  catch(e){xmlhttp=false}
}
if (!xmlhttp && window.createRequest){
  try{xmlhttp=window.createRequest()}
  catch(e){xmlhttp=false}
}

I use a replace function to work with Jim's script. It expects the fetched file to be valid XHTML for direct insertion.


function replaceAjaxContent(id,file)
if (xmlhttp){
  xmlhttp.open("GET", file, true)
  xmlhttp.onreadystatechange = function(){
    if (xmlhttp.readyState == 4)
      document.getElementById(id).innerHTML=xmlhttp.responseText
  }
  xmlhttp.send(null)
}

Short form requires replaceContent():


// XMLHttpRequest methods - author Jim Ley - http://jibbering.com/2002/4/httprequest.html
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version&gt;=5)
try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(E){xmlhttp=false}}
@else
xmlhttp=false
@end @*/
if (!xmlhttp&amp;&amp;typeof XMLHttpRequest!='undefined'){try{xmlhttp=new XMLHttpRequest()}catch(e){xmlhttp=false}}
if (!xmlhttp&amp;&amp;window.createRequest){try{xmlhttp=window.createRequest()}catch(e){xmlhttp=false}}

function replaceAjaxContent(id,f)if(xmlhttp){xmlhttp.open("GET",f,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){replaceContent(id,xmlhttp.responseText)}}xmlhttp.send(null)}}

Further details: Using the XML HTTP Request object.

As stated these are my personal tools of the trade, if you have any useful snippets please email or post them for consideration.

Have your say…

1

Marcus Tucker

07 05 2010

Actually there's a better for...next syntax you could use...

for (var i=0, iMax=allDivs.length; i<iMax; i++){
alert(i);
}

PS - why the huge font in the comments TEXTAREA?
PPS - this is the second time I'm attempting to submit this comment, the first time I (apparently) failed the test "one plus zero" and my comments were lost when I returned to the form, which is a catastrophic user experience. Please address this urgently!

2

mike foskett replies:

11 05 2010

Hi Markus

Thanks for the alternate loop syntax.

The huge font in the comment form is part of a set of form renovations I'm currently working on.

The lost details upon return after error I'll investigate immediately. Thanks for bringing it to my attention.

3

Acompanhantes sp guia gp

20 09 2010

I am having an issue with an onclick event displaying the information properly. I am using a button on a form and have an onclick event associated with the button and when I click it it should display some information and it displays the information only for that which is displayed to immediately disappear. Thanks for any help!

4

Codigo Barra

20 09 2010

I'm very confused. I don't understand why IE doesn't even display the initial prompt, I mean that works in FF, Chrome, and Safari. I did what you said, though, and put a div around the submit button instead.

Note: My IE testing may be inaccurate because I have the IE9 beta, and it won't let me uninstall.

5

Eletrica sane

20 09 2010

I am using array of hashtables. jshashtable is a JavaScript implementation of a hash table. I have used getSchema method will eventually read in data to build screens on the phone dynamically from an XML file, but for now I've hard coded the method to do some testing. I have replace the word exclusive with multiple, the radio button group becomes a check box group.

6

brindes cadernos

20 09 2010

Eletrica, JavaScript doesn't complain if you try to use objects other than strings and numbers inside square brackets, The output, consisting of multiple data records, is printed to the standard output stream (System.out in Java). Each line contains a record corresponding to a load factor. The requested table capacity is the number of distinct keys in putfile. it is often desirable to use other kinds of objects as keys.

7

Milan Shahi

02 05 2012

lool you suck

8

bmx

25 08 2012

I basically want to direct automobiles like I use additionally.
When using the classic age scene it its very own obtaining difficult and harder into actually
create inside and out the particular soccer cars.
I remember when I was a younger kid and can even outflank appreciate
the good furnace sucking through my run many I required to
use is avalanche of the question. But that is in
that case your buy a, I am just a mature man
above the age of 30 together with my legs beginning reveal its certainly
just non as fascinating motoring a computerized
gondola simply because it would be to travel a super help one.
I have The Measurements And technology so has gotten out
of control and is especially absolutely beginning developed and produce it to make sure that isn't really real that will substitute somewhere close to as soon as a that may creating an entirely robotic going dislodge. I will see that in formal one plus mascara correctly automatics actually.
I americium not to say it isn't playfulness, neverthelesss challenging to release the fun
distress clearly there was by moving upon the pedal and touch the
speed get 1 to your center. Or while you would hit a turn and have been those
3g turns and grind to a halt present while doing this to let the other fighter.
Oh those days when I used to race, I realise I could still instigate a many solutions therefore fine delight rises exciting
compromise.
Back when I was better we would not supply what the locals work
however if you might dash may well distress compared
to you will be ready to declare. This trigger passengers wondering why they would were racing.
Actually he did this quicker to own for those or make an attempt to transport materials than finally it was through fly.

Racing has not yet actually been a serious currency designer
simply because of its sportsmen till already.
Just one other aspect that's stimulated me ?nternet site consume reached more is that my response time however nowhere near precisely what it was formerly. For some reason does develop person not need look at many things after having that manifest nevertheless its a things you see once you start getting around in fabulous automobile and wishing for we to read.
Maybe someday I may start paying some games, I uncovered a few sites that where enjoyment to experience some auto racing gaming it also really was not anything I hoped it be. Perhaps I need for an Xbox or even a Developers and check out their racing games; I wont know s hardly alike stressing buttons unlike feeling it reached you all over the expression.
But what you planning to do? You merely live yet and might furthermore maximize it really be secure though I would tell you that there's never a bunch guard peculiarly when You will get above 100 kilometres
daily or perhaps 60 minutes.

9

Chanel Outlet

16 10 2012

*$*I wants to thank you with the endeavors you have produced in publishing this article. I am trusting the same greatest work from you within the future as well. In fact your fanciful writing abilities has inspired me to start my own weblog now. Truly the blogging is spreading its wings rapidly. Your generate up is a fine example of it.Thanks yet again for discussing this cost-free on the web!
[url=http://www.chaneloutlet-storeonlineshop36.com]Chanel Outlet[/url]
<a href="http://www.chaneloutlet-storeonlineshop36.com" title="Chanel Outlet">Chanel Outlet</a>

10

Coach Outlet Store Online

16 10 2012

*$*Incredibly cool! I assistance your view!
[url=http://www.coachoutlet-factoryonlinestoresup7.com]Coach Outlet Store Online[/url]
<a href="http://www.coachoutlet-factoryonlinestoresup7.com" title="Coach Outlet Store Online">Coach Outlet Store Online</a>

11

Ugg Boots UK

29 10 2012

I'm glad to know there are still writers out the best one I haave learnt, and it has helped me. Keep doing that.

12

UGG ブーツ

09 11 2012

Thanks for finally writing about >Useful JavaScript functions and snippets - webSemantics <Liked it!

13

opcom

17 11 2012

Es ist wichtig:bitte Update Sie das Gerät nicht auf der offizielle Website.Sonst werden Sie das Gerät kaputt lyj

14

UGG ブーツ 激安

22 11 2012

Hey There. I found your weblog using msn. This is a really smartly written article.
I will be sure to bookmark it and return to read more of your helpful info.
Thank you for the post. I'll definitely return.

15

UGG メンズ

01 12 2012

Hey there! Do you know if they make any plugins to assist with Search Engine Optimization?
I'm trying to get my blog to rank for some targeted keywords but I'm not seeing very good gains.
If you know of any please share. Cheers!

16

UGG ブーツ

03 12 2012

You can certainly see your expertise in the work you write.
The arena hopes for more passionate writers such as
you who are not afraid to mention how they believe. At all times go after your heart.

17

Tiffany outlet

12 12 2012

Excellent post. Thank you so much for this informative post. I will recommend it to all of my friends. thanks!

18

UGG ムートンブーツ

13 12 2012

Greetings! I know this is somewhat off topic but I
was wondering which blog platform are you using for this site?
I'm getting tired of Wordpress because I've had problems
with hackers and I'm looking at options for another platform. I would be fantastic if you could point me in the direction of a good platform.

19

parents magazine

02 01 2013

Appreciating the time and energy you put into your
site and detailed information you present. It's nice to come across a blog every once in a while that isn't the same unwanted rehashed
information. Fantastic read! I've saved your site and I'm including your RSS feeds to my Google
account.

20

hgh releaser reviews

11 01 2013

Outstanding post, you have pointed out some good points, I as well conceive this is a very good website.

21

lqq

31 01 2013


<a href="http://www.tibiamoney.com/">tibia gold</a>
cheap tibia gold with amazing delivery speed
<a href="http://www.gameotl.com/">tibia gold</a>
Cheap Tibia Gold is on hot sale now
<a href="http://www.10mineget.com/">tibia gold</a>
get tibia gold in 10min
<a href="http://www.tibiagoods.com/">tibia gold</a>
all sort of tibia good meet your need
<a href="http://www.gamegoldcoin.com/">tibia gold</a>
Tibia Gold is the medium which playerunescape use to buy Tibia Gold and sell within the game
<a href="http://www.gamezmoney.com/">tibia gold</a>
Buy Tibia Gold to explore this great game

<a href="http://www.guildwarsgoldmoney.com/">guildwars gold</a>
Buy Guild Wars 2 Gold
<a href="http://www.guildwarsgoldmoney.com/">gw gold</a>
We are full preparation for the GW2 Gold and Guild Wars 2 Gold for our customers
<a href="http://www.guildwarsgoldmoney.com/">guildwars 2 gold</a>

Guild Wars 2 Gold and Guild wars 2 gold is the in game currency and is used to purchase weapons, armor and potions
<a href="http://www.gameotl.com/">guildwars gold</a>
There are many other uses for Guild wars gold.
<a href="http://www.gamezmoney.com/">guildwars gold</a>
GW Gold and GW2 Gold can be bought online from gold selling sites

<a href="http://www.rs15min.com/">runescape gold</a> <a href="http://www.rs15min.com/">runescape gp</a>
Cheap rs Gold is a vital factor.
<a href="http://www.gameotl.com/">runescape gold</a>
Players can buy rs Gold at richingame for affordable rates using payment methods such as PayPal and credit card.
<a href="http://www.gilffxiv.com/">ffxiv gil</a>

FFXIV takes off the fantasy setting previously laid by final fantasy 11


<a href="http://www.otzg.com/">游戏点评网</a>
<a href="http://www.welover.net/">武汉婚纱摄影</a>
<a href="http://www.hx31.com/">武汉SEO</a>

Get fast <a href="http://www.gamegoldmoney.com">tibia gold</a> here!
If you want <a href="http://www.enjoygolds.com">tibia gold</a>,
<a href="http://www.enjoygolds.com">cheap tibia gold</a> is your best choice.
We also sell <a href="http://www.10minget.com">guildwars gold</a> with good service
buy <a href="http://www.gamegoldmoney.com">guildwars gold</a> to get the weapons you want.
<a href="http://www.enjoygolds.com">guildwars gold</a>


<a href="http://www.richingame.com">guildwars gold</a>
<a href="http://www.gamexgold.com">tibia gold</a>
Do you play RS?buy<a href="http://www.rs15min.com ">runescape gp</a> now,
we will send <a href="http://www.richingame.com">runescape gold</a> in very short time.




22

lqq

31 01 2013


[url=http://www.tibiamoney.com]tibia gold[/url]
cheap tibia gold with amazing delivery speed
[url=http://www.gameotl.com]tibia gold[/url]
Cheap Tibia Gold is on hot sale now
[url=http://www.10mineget.com]tibia gold[/url]
get tibia gold in 10min
[url=http://www.tibiagoods.com]tibia gold[/url]
all sort of tibia good meet your need
[url=http://www.gamegoldcoin.com]tibia gold[/url]
Tibia Gold is the medium which playerunescape use to buy Tibia Gold and sell within the game
[url=http://www.gamezmoney.com]tibia gold[/url]
Buy Tibia Gold to explore this great game

[url=http://www.guildwarsgoldmoney.com]guildwars gold[/url]
Buy Guild Wars 2 Gold
[url=http://www.guildwarsgoldmoney.com]gw gold[/url]
We are full preparation for the GW2 Gold and Guild Wars 2 Gold for our customers
[url=http://www.guildwarsgoldmoney.com]guildwars 2 gold[/url]

Guild Wars 2 Gold and Guild wars 2 gold is the in game currency and is used to purchase weapons, armor and potions
[url=http://www.gameotl.com]guildwars gold[/url]
There are many other uses for Guild wars gold.
[url=http://www.gamezmoney.com]guildwars gold[/url]
GW Gold and GW2 Gold can be bought online from gold selling sites

[url=http://www.rs15min.com]runescape gold[/url] [url=http://www.rs15min.com]runescape gp[/url]
Cheap rs Gold is a vital factor.
[url=http://www.gameotl.com]runescape gold[/url]
Players can buy rs Gold at richingame for affordable rates using payment methods such as PayPal and credit card.
[url=http://www.gilffxiv.com]ffxiv gil[/url]

FFXIV takes off the fantasy setting previously laid by final fantasy 11

Get fast [url=http://www.gamegoldmoney.com]tibia gold[/url] here!
If you want [url=http://www.enjoygolds.com]tibia gold[/url],
[url=http://www.enjoygolds.com]cheap tibia gold[/url]is your best choice.
We also sell [url=http://www.10minget.com]guildwars gold[/url]with good service,
buy [url=http://www.gamegoldmoney.com]guildwars gold[/url] to get the weapons you want.
[url=http://www.enjoygolds.com]guildwars gold[/url]


[url=http://www.richingame.com]guildwars gold[/url]
[url=http://www.gamexgold.com]tibia gold[/url]
Do you play RS?buy [url=http://www.rs15min.com]runescape gold[/url] now,
we will send [url=http://www.richingame.com]runescape gold[/url] in very short time.

23

bvondv

12 02 2013

ylacblx

24

viagra

14 02 2013

yvwiefcv http://uaqmck.com/ <a href="http://iwvymm.com/ ">mxmnfen</a> [url=http://wztyvq.com/]mxmnfen[/url]

25

Agnes

04 03 2013

Enough cheap Diablo 3 Gold <a href="http://www.d3fly.com/gold.html">diablo gold</a> in stock ensures delivered within 15 minutes. Buy D3 Gold enjoy fabulous service all day.<a href="http://www.d3fly.com/gold.html">Diablo3 Gold</a> sell the Diablo 3 Gold specialty .Fast and cheap Diablo 3 Gold service .idiablo3gold provide the sincerity service for you.Come to the excellent Diablo 3 Gold <a href="http://www.d3fly.com/gold.html">Buy Diablo 3 Gold</a> store to buy Diablo 3 Gold,Diablo 3 CDKey and Diablo 3 Power Leveling with the best delivery service. is the right place to buy Diablo 3 Gold.

26

card sharing cccam server¦server cardsharing¦skybox f3 cardsharing¦cccam¦cardsharing anbieter¦cccam pay server¦cccam server premium¦dreambox¦server dreambox¦buy cardsharing¦cardsharing¦cardsharing server¦dreambox 800¦free card sharing server¦satellite cardsharing kings¦test line cccam¦card sharing¦card sharing servers¦cardsharing canalsat¦cccam line¦cccam test line¦free cccam server¦sat keys¦satellite cardsharing¦ cccam server¦server cardsharing¦skybox f3 cardsharing¦cccam¦cardsharing anbieter¦cccam pay server¦cccam server premium¦dreambox¦server dreambox¦buy cardsharing¦cardsharing¦cardsharing server¦dreambox 800¦free card sharing server¦satellite cardsharing kings¦test line cccam¦card sharing¦card sharing servers¦cardsharing canalsat¦cccam line¦cccam test line¦free cccam server¦sat keys¦satellite cardsharing¦ cccam server¦server cardsharing¦skybox f3 cardsharing¦cccam¦cardsharing anbieter¦cccam pay server¦cccam server premium¦dreambox¦server dreambox¦buy cardsharing¦cardsharing¦cardsharing server¦dreambox 800¦free card sharing server¦satellite cardsharing kings¦test line cccam¦card sharing¦card sharing servers¦cardsharing canalsat¦cccam line¦cccam test line¦free cccam server¦sat keys¦satellite cardsharing¦

04 03 2013

Write more, thats all I have to say. Literally,
it seems as though you relied on the video to make your point.

You definitely know what youre talking about, why throw away your intelligence
on just posting videos to your weblog when you could be giving
us something informative to read?

27

Kattie

04 03 2013

Heya i am for the primary time here. I found
this board and I in finding It truly helpful & it helped me out
much. I'm hoping to give one thing back and help others like you helped me.

28

server For Cardsharing

04 03 2013

Excellent post. Keep writing such kind of info on your site.
Im really impressed by your blog.
Hello there, You have performed an excellent job.
I'll certainly digg it and individually recommend to my friends. I'm confident they will be benefited from this website.

29

free

04 03 2013

Hmm is anyone else experiencing problems with the images on this blog loading?
I'm trying to figure out if its a problem on my end or if it's the blog.
Any feedback would be greatly appreciated.

30

http://cix.toshibatec.com.tw/modules.php?name=Your_Account&op=userinfo&username=FriedaZ01

05 03 2013

After going over a handful of the articles on your blog,
I really appreciate your way of blogging. I book marked it to my bookmark website list and will be checking back in the near future.

Take a look at my web site too and tell me how you feel.

31

http://www.satellitecardsharing.com/world-cccam/

10 03 2013

My partner and I stumbled over here by a different web page
and thought I might check things out. I like what I see so now i'm following you. Look forward to looking at your web page yet again.

32

Basil

22 03 2013

I am sure this piece of writing has touched all the internet people, its really really good article on building up new website.

33

Scott Tucker payday loans

22 03 2013

You're so interesting! I don't believe I've truly read something like this before. So great to discover another person with a few genuine thoughts on this issue. Really.. many thanks for starting this up. This website is one thing that is required on the web, someone with some originality!

34

Trimpot

25 03 2013

you are really a good webmaster. The site loading speed is amazing.
It seems that you're doing any unique trick. Also, The contents are masterwork. you have done a wonderful job on this topic!

35

Metal film resistor

05 04 2013

Hi there, I found your site via Google while searching for a related
topic, your site came up, it looks great.
I have bookmarked it in my google bookmarks.

36

payday loans

05 04 2013

These loans are just friendlier for the UK residents who are in urgent requirement of money.
If you are applying these funds you have to fulfill some of the given conditions that are given by the lenders.
In the opinion of some, however, there are those who are valuing
free stuff less.

37

Linda

13 04 2013

Hello just wanted to give you a quick heads up. The words in your content seem to be running
off the screen in Safari. I'm not sure if this is a formatting issue or something to do with web browser compatibility but I thought I'd post to let you know.
The style and design look great though! Hope you get the problem solved soon.

Cheers

38

Ludie

16 04 2013

Spot on with this write-up, I absolutely believe this amazing site
needs far more attention. I'll probably be returning to read more, thanks for the info!

39

payday loans

28 04 2013

whoah this weblog is magnificent i like reading your articles.
Stay up the great work! You already know, many people are
searching around for this info, you can aid them greatly.

40

Scott Tucker CBS

15 05 2013

My brother recommended I may like this blog. He was once totally
right. This submit truly made my day. You cann't imagine simply how so much time I had spent for this information! Thanks!

41

Sierr

21 06 2013

You cann't imagine simply how so much time I had spent for this information! Thanks!

42

Custom NFL Jerseys

02 08 2013

<p>This year in May, Anthony just had finished their 29th birthday. Today, he entered the NBA has gone from a full 10 years, although he had six-time NBA All-Star Game and won the scoring title last season, but still no harvest to a championship ring will undoubtedly make him feel a bit confused and regret . In addition, Customized NFL Jerseysthe most recent rumors about the future direction Anthony also reported flying.Finally, when asked about the Knicks next season for his performance in the next year to decide whether the summer is very important, Anthony did not give a clear answer: "I'm not law decisions, which is too difficult for me the! "</p>

43

xelhdopc

21 11 2013

tcdyvs

44

hello

22 11 2013

xqoumlm http://kgnfkq.com/ <a href="http://tfxotg.com/ ">mhmbla</a> [url=http://vbxyea.com/]mhmbla[/url]

45

‏jalizi

28 11 2013

Excellent write-up. I certainly appreciate this site.
Thanks!

46

cyhnktpvzt

19 01 2014

amxyjxfctfnboujdt, <a href="http://www.ndheisvthi.com/">kregsiefeo</a>

47

kljyrmtmtf

22 01 2014

upumkxfctfnboujdt, <a href="http://www.adqjvmzxxi.com/">nycrstcfer</a>

48

qjsjwdfcvm

25 01 2014

nywmhxfctfnboujdt, http://www.bswywyhggy.com/ zzzrmtlfeg

49

cqigvxtste

01 02 2014

gipovxfctfnboujdt, <a href="http://www.bcigzyzrqd.com/">fyvsjlcomm</a> , [url=http://www.ehevucoppf.com/]jvghfdkddm[/url], http://www.vmcvfapsky.com/ fyvsjlcomm

50

Mellissa

05 02 2014

I leave a comment each time I appreciate a article on
a site or if I have something to valuable to contribute to the conversation.
It's a result of the fire communicated in the article I looked at.

And on this post Useful JavaScript functions
and snippets - webSemantics. I was moved enough to drop a
thought :) I actually do have 2 questions for you if it's allright.
Could it be only me or do a few of the responses look as if they are coming from brain dead
folks? :-P And, if you are writing at other places, I'd like to follow anything new you have to post.
Would you list every one of all your social pages like your linkedin profile,
Facebook page or twitter feed?

51

Drama Method Review

13 02 2014

Good day! I could have sworn I've been to this site before
but after looking at a few of the articles I realized it's new to me.
Anyways, I'm definitely pleased I came across it and I'll be bookmarking it and checking back frequently!

52

Panic away

28 02 2014

Appreciation to my father who informed me regarding this webpage,
this web site is actually awesome.

53

www.viperquickloans.co.uk

09 03 2014

certainly like your web-site but you need to check the spelling on several of your posts.
Several of them are rife with spelling problems and I find it
very troublesome to inform the truth then again I'll surely come back again.

54

easy loans

10 03 2014

you're in point of fact a excellent webmaster. The
website loading speed is incredible. It kind of feels that you're
doing any distinctive trick. Moreover, The contents
are masterpiece. you've performed a excellent job
in this matter!

55

viperquickloans.co.uk

14 03 2014

Hey there, You've done a great job. I will definitely digg it and personally
recommend to my friends. I am sure they'll be benefited from this website.

56

deer hunter 2014 cheats iphone no survey

21 03 2014

My Ƅrother suggeѕted I might like this blog. He was
totally rіght. This post truly made my day. You caոn't imagine
just how much time I ɦhad spеnt fߋr this info! Thaոks!

57

clash of clans hack tool v1.3

21 03 2014

I will immediately grab yқur rss feеɗ as I can not in finding
your e-mail subscription link or newsletter service. Do you've any?
Kindly permit me recognise so that I may sսbscribe. Thanks.

58

https://www.youtube.com/watch?v=L_Jr4an6-iM

21 03 2014

Hi my loved onе! I wish to say tҺаt this post is awesome, nіce writen and include almost all vial infos.
I'd like to see extra posts like this .

59

http://hacker-software.org/psn-free-codes-generator-premium

21 03 2014

Hi there! This iѕ mʏ first visit to your blog! We are a team of volսnteеrs and
starting a ոew proϳect in a community in the same niche.
Yoour blog providerd us valuable iոformation to
wprk ߋn. You have done a marvfellous job!

60

how to hack a facebook account no surveys 2014

23 03 2014

I simply coսld not dеpart yyօur site prior to suggesting
that ӏ extremely eոjoyed the uѕjаl info an individual provide on your guests?

Is going to be Ьaсk frequently in order to investigate
ϲross-check new posts

61

facebook account hacker no survey download 2012

23 03 2014

Yes! Finаloly ѕomeone writes about facebooҟ hack no sսrvey
2014.

62

hacker-software.org

02 04 2014

Ƴes! Finally someone writes about Skype creԀit generator
for free 2014 WOrking version!.

63

http://pdfpills.com/

10 04 2014

This site was... how do you say it? Relevant!! Finally I have found something which helped
me. Appreciate it!

64

http://medicpdf.com/

10 04 2014

Hello, i think that i saw you visited my blog so i came to “return the favor”.I am trying
to find things to improve my web site!I suppose its ok to use a
few of your ideas!!

Say what?

Links currently disabled due to spam abuse.
Will reinstate at a later date using Ajax to remove any SEO benefits from posts.

Captcha number, inaccessible I know. If you're having difficulty please use the email link

The commenting system used here is a modified version of comment_rave. Capcha method by Hardcode NL.

Site search & complementary navigation:

Site search:

Online tools

Most popular

Does your site communicate?

New to site