/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function $_GET(a) { return (a = location.search.match(RegExp("[?&]" + a + "=([^&]*)(&?)", "i"))) ? a[1] : a } // example, if browser's url was like: // http://www.google.co.in/search?q=web&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a // then you can get the value of any parameter like: alert($_GET('rls')); // returns org.mozilla:en-US:official as an alert
Comments
