function getRequest(param){
    if(location.search){ //if address has parameters,
        var baseRequest = location.search.substr(1);  //remove ?      
        var arrVars = baseRequest.split("&");
        for(i=0;i<arrVars.length;i++){
            var tmpVar = baseRequest.split("&")[i].split("=");
            if(param==tmpVar[0]) return tmpVar[1];
        }
    }
    return null;
}

http://test.html?a=2&b=3

alert(getRequest("a"));

result : 3

잘 써먹기 바랍니다.

'기타 > Old' 카테고리의 다른 글

For In  (0) 2008.08.12
onfocus 등의 호출시점 => 매우 중요함.  (0) 2008.07.05
파싱이후 숫자 유효성 검증하는거 예시  (0) 2008.06.11
XUL 시작하기  (0) 2008.06.10
iPod  (0) 2008.06.09

+ Recent posts