javascript取得get方式の参考



(function(){
var get = window.$_GET = {};
var args = location.search.replace('?','').split('&');
for(var i=0,j=args.length,temp;i temp = args[i].split('=');
get[temp[0]] = temp[1];
}
})();
// $_GET['xxx'] ?

//
if(!$_GET['arg1'])location.href = "?arg1=111&arg2=4545454545";
for(var p in $_GET){
document.getElementById('log').innerHTML += ' '+p+' :'+$_GET[p]+'
';
}