String.prototype.getQuery = function(name)
{
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = this.substr(this.indexOf("?")+1).match(reg);
if (r!=null) return unescape(r[2]); return null;
}
var s = "index.html?id=1&goto=baidu";
alert(s.getQuery("id"));
alert(s.getQuery("baidu"));