(function() {
var urlToObject = function(url) {
var urlObject = {};
if (/?/.test(url)) {
var urlString = url.indexOf("?") 1); urlArray = urlString.split("&");
for (var i=0, len=urlArray.length; ivar urlItem = urlArray[i]; = urlItem.split("=");
urlObject[アイテム[0]] = アイテム[1]
}
var testUrl; = "http://tools.jb51.net/index.php?key0=0&key1=1&key2=2";
var result = urlToObject(testUrl);
for (結果の var キー) {
アラート(キー "=" 結果[キー])
}
})();