댓글 검색 목록

[javascript] 자바스크립트 : Get URL Variables

페이지 정보

작성자 운영자 작성일 18-08-30 13:33 조회 780 댓글 0
  1. // Read a page's GET URL variables and return them as an associative array.
  2. function getUrlVars()
  3. {
  4. var vars = [], hash;
  5. var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
  6.  
  7. for(var i = 0; i < hashes.length; i++)
  8. {
  9. hash = hashes[i].split('=');
  10. vars.push(hash[0]);
  11. vars[hash[0]] = hash[1];
  12. }
  13.  
  14. return vars;
  15. }

댓글목록 0

등록된 댓글이 없습니다.

웹학교 로고

온라인 코딩학교

코리아뉴스 2001 - , All right reserved.