var url = ‘http://www.deikang.com/index.php?tel=15811296111&status=1&id=100‘; var n = url.indexOf(‘?‘); //alert(n); var m = url.substring(n + 1, url.length); //alert(m); var arr = m.split(‘&‘); //alert(arr); for (var i in arr) { //alert(arr[i]); //var reg=new RegExp(‘tel=‘); var reg = /tel=/; if (reg.test(arr[i])) { alert(arr[i]); } }
总结:用window.location.search可获得?tel=15811296111&status=1&id=100
时间: 2024-11-05 04:09:03