87,910
社区成员
发帖
与我相关
我的任务
分享
学生学号:<input id="id" type="text" value='id'><br>
学生成绩:<input type="text" id="score"><br>
//获取url中的参数
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); //匹配目标参数
if (r != null) return unescape(r[2]); return null; //返回参数值
}
getUrlParam("id")
var request = (function (){
var obj = {};
var arr = window.location.search.slice(1).split("&");
for (var i = 0, len = arr.length; i < len; i++) {
var nv = arr[i].split("=");
obj[decodeURIComponent(nv[0]).toLowerCase()] = decodeURIComponent(nv[1]);
}
return obj;
})();
window.onload = function () {
document.getElementById("id").value = request.id;
}