Javascript - Get QS


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <script>
  2. function getQueryVariable(variable) {
  3. var query = self.location.search.substring(1);
  4. var vars = query.split("&");
  5. for (var i=0;i<vars.length;i++) {
  6. var pair = vars[i].split("=");
  7. if (pair[0] == variable) {
  8. if( variable == 'swf'){
  9. salida = new String(pair[1]);
  10. salida2 = salida.substr(0,salida.length-4);
  11. }else{
  12. salida2 = pair[1];
  13. }
  14. return salida2;
  15. }
  16. }
  17. }
  18.  
  19. document.write(getQueryVariable('variableGET').toString())
  20. </script>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.