复制代码 代码如下:
<script type=”text/javascript”>
String.prototype.getQuery = function(name){
var reg = new RegExp(‘(^|\?|&)’+name+’=([^&]*|$)’), url = this.replace(/&/g, ‘&’), r = url.match(reg);
return r === null ? null : unescape(r[2]);
}
var str = ‘http://wpa.qq.com/msgrd?v=3&uin=1438344583&site=qq&menu=yes’;
alert(str.getQuery(‘uin’));
</script>
String.prototype.getQuery = function(name){
var reg = new RegExp(‘(^|\?|&)’+name+’=([^&]*|$)’), url = this.replace(/&/g, ‘&’), r = url.match(reg);
return r === null ? null : unescape(r[2]);
}
var str = ‘http://wpa.qq.com/msgrd?v=3&uin=1438344583&site=qq&menu=yes’;
alert(str.getQuery(‘uin’));
</script>