Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script ...>
- param1var = ... // ... would be replaced with the code to get asdf from url
- </script>
- <script>
- var param1var = getQueryVariable("param1");
- function getQueryVariable(variable) {
- var query = window.location.search.substring(1);
- var vars = query.split("&");
- for (var i=0;i<vars.length;i++) {
- var pair = vars[i].split("=");
- if (pair[0] == variable) {
- return pair[1];
- }
- }
- alert('Query Variable ' + variable + ' not found');
- }
- </script>
- function querystring(key) {
- var re=new RegExp('(?:\?|&)'+key+'=(.*?)(?=&|$)','gi');
- var r=[], m;
- while ((m=re.exec(document.location.search)) != null) r[r.length]=m[1];
- return r;
- }
- var param1var = querystring("param1")[0];
- document.write(querystring("name"));
- if (querystring('id')=='42') alert('We apoligize for the inconvenience.');
- if (querystring('button').length>0) alert(querystring('info'));
- function gup( name ){
- name = name.replace(/[[]/,"\[").replace(/[]]/,"\]");
- var regexS = "[\?&]"+name+"=([^&#]*)";
- var regex = new RegExp( regexS );
- var results = regex.exec( window.location.href );
- if( results == null )
- return "";
- else
- return results[1];
- }
- var matches = /param1=([^&#=]*)/.exec(window.location.search);
- var param1 = matches[1];
Add Comment
Please, Sign In to add comment