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 = "web1.aspx?status=item&mode=edit";
alert(s.getQuery("status"));
alert(s.getQuery("mode"));
String.prototype.getQuery = function(name)
的意思是为String对象增加一个getQuery(name)方法.