<script src="a.js?time=123456"><script>
怎么在js中获取参数后面time的内容123456
------解决方案--------------------
//读取url参数
function scriptQueryString(name) {
var scripts = document.getElementsByTagName("script");
var url = scripts[scripts.length - 1].src;
if (url.indexOf("?") == -1
------解决方案--------------------
url.indexOf(name + '=') == -1) {
return '';
}
var reg = new RegExp(name + "=([^&]*)(&
------解决方案--------------------
$)", "i");
var r = url.match(reg);
if (r != null) return unescape(r[1]);
return '';
}
var time_Code = scriptQueryString("time");