function getQueryString(name)
{
var reg = new RegExp("(^|&)"+name+"=([^&]*)(&|$))","i");
var r = window.location.search(1).match(reg);
if(r!=null) return unescape(r[2]); return null;
}
//调用
var name = getQueryString(name)
原文:http://www.cnblogs.com/m-r-j/p/4277976.html