function urlArgs(){

var args = {};

var query = location.search.substring(1);

if(query){

   if(query.indexOf('=') == -1){

    alert('参数形式错误');

     return false;

  }else{

    var pairs = query.split('&');

    for(var i = 0; i < pairs.length; i++){

      var pos = pairs[i].indexOf('=');

      if(pos == -1) continue;

      var name = pairs[i].substring(0, pos);

      if(!name){

        alert('参数名不能为空');

        return false;

      }

      var value = pairs[i].substring(pos + 1);

      value = decodeURIComponent(value);

      args[name] = value;

      }

    }

  }else{

    alert('没有参数');

    return false;

  }

  return args;

}

05-06 03:40