We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

sendoa on 05/21/08


Tagged

url javascript parametros


Versions (?)


Leer parámetros de la dirección con javascript


Published in: JavaScript 


URL: http://sentidoweb.com/2008/05/20/laboratorio-detectar-parametros-de-la-url-en-javascript.php

  1. // Obtenemos la URL
  2. var url = document.location.href;
  3. // Nos quedamos con los parámetros
  4. url = url.substring(url.lastIndexOf('?')+1);
  5. // Dividimos los distintos parámetros
  6. url = url.split('&');
  7. // Almacenamos los parámetros en un array(param => valor)
  8. var res = new Array();
  9. for(var i=0; i
  10.  
  11. //PARA URL AMIGABLES
  12.  
  13. //Obtenemos la Query String (URL - host)
  14. var url = document.location.href;
  15. url = url.substring(url.lastIndexOf(document.location.host)+1);
  16. // Separamos mediante la barra (/)
  17. var res = url.split('/');

Report this snippet 

You need to login to post a comment.