获取页面内容封装成json对象

2021-06-19 00:06

阅读:438

标签:return   mil   gif   var   each   data   params   i++   ring   

function(params, dom){
  var courseName= document.getElementsByName("courseName");
  var teacherName = document.getElementsByName("teacherName");
  var courseId = document.getElementsByName("courseId");
  var courseList = [];
  for(var i=0; i
  if(courseId.length > i){
  var id = courseId[i].value;
  }
  else id = ‘‘;
  var course = { "id": id, "name":courseName[i].value,"teacherName":teacherName[i].value};
  courseList.push(course);
  }
  console.info(courseList);
  params.courseList = courseList;
  params = {data:JSON.stringify(params)};
  return params;
}

获取页面内容封装成json对象

标签:return   mil   gif   var   each   data   params   i++   ring   

原文地址:http://www.cnblogs.com/xiaolin-peter/p/7195992.html


评论


亲,登录后才可以留言!