Get URL Parameters with JavaScript

http url

With the wide use of AJAX, sometimes we need get values of parameters from current URL, the below function is an very handy way to do so. function getQuery(name) { var reg = new RegExp(“(^|&)”+ name +”=([^&]*)(&|$)”); var r = window.location.search.substr(1).match(reg); if (r!=null) return unescape(r[2]); return null; } Example: Get the id’s value from http://codemug.com/a.php?c=my&id=7&m=1 […]

JavaScript Strict Mode in IE 10

Strict Mode has been introduced from ECMAScript 5.0, the intent is to encourage developers choose an more standard version of JavaScript. For a long time, JavaScript has been┬ácontroversial for its loose and flexible syntax. Including Strict Mode in ECMAScript 5.0 makes it possible for Javascript’s interpreter to parse lines using Strict Mode syntax, which helps […]