http://oldlearn.open.com.cn/OEMSExercise/HomeworkReview.aspx?HomeworkId=9c034488-0a3d-4b9d-a6cc-e42200459094&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&SectionIndex=1

想要提取页面上 选定答案的 并且打印到控制台

var answer=''; $('.TestItemBody').each(function(i){var txt=$(this).children(":last").text().match(/([A-Z]+)/g)[0]; answer+=txt; if((i+1)%5==0)answer+=' '; if($(this).parent().attr('id')=='divSection2')answer+=' '; });console.log(answer);
var answer=''; $('.TestItemBody').each(function(i){ $(this).children().find("input").each(function(j){ if($(this).attr("checked"))console.log(i+" "+j+" "+$(this).attr("checked",true)[0].nextSibling.nodeValue);}) })
var answer=''; $('.TestItemBody').each(function(i){ $(this).children().find("input").each(function(j){  if($(this).attr("checked")){ var ans= $(this).attr("checked",true)[0].nextSibling.nodeValue.match(/([A-Z]+)/g)[0];  answer+=ans;    }  }); if((i+1)%5==0)answer+=' '; if($(".myCourseNavOver").text().lastIndexOf("多选题")!=-1)answer+=' '; }); console.log(answer);
var answer = '';
$('.TestItemBody').each(function(i) {
    $(this).children().find("input").each(function(j) {
        if ($(this).attr("checked")) {
            var ans = $(this).attr("checked", true)[0].nextSibling.nodeValue.match(/([A-Z]+)/g)[0];
            answer += ans;
        }
    });
    if ((i + 1) % 5 == 0) answer += ' ';
    if ($(".myCourseNavOver").text().lastIndexOf("多选题") != -1) answer += ' ';
});
console.log(answer);
// jquery 方式获取radio的 文本值
 $(this).attr("checked", true)[0].nextSibling.nodeValue;
//只取 字母部分
 $(this).attr("checked", true)[0].nextSibling.nodeValue.match(/([A-Z]+)/g)[0];
var answer=''; $('.TestItemBody').each(function(i){ $(this).children().find("input").each(function(j){  if($(this).attr("checked")){ var ans= $(this).attr("checked",true)[0].nextSibling.nodeValue.match(/([A-Z]+)/g)[0];  answer+=ans;    }  }); if((i+1)%5==0)answer+=' '; if($(".myCourseNavOver").text().lastIndexOf("多选题")!=-1)answer+=' '; }); console.log(answer);
多选题: ABC ABCD AB ABC CD  ABC AD AB C BCD
var answer=''; $('.TestItemBody').each(function(i){ $(this).children().find("input").each(function(j){  if($(this).attr("checked")){ var ans= $(this).attr("checked",true)[0].nextSibling.nodeValue.match(/([A-Z]+)/g)[0];  answer+=ans;    }  }); if((i+1)%5==0)answer+=' '; if($(".myCourseNavOver").text().lastIndexOf("多选题")!=-1)answer+=' '; }); console.log(answer);
单选题: BBAAA BAABA

最新文章

  1. Basic Tutorials of Redis(2) - String
  2. [转]使用EasyRsa3为OpenVPN生成密码
  3. [ORM] Entity Framework(2) CodeFirst进阶
  4. 三种另外的循环 while{} 和do{}while{}还有switch case
  5. novnc ignoring socket not reay
  6. Object.defineProperty 规则
  7. Android多线程断点续传下载
  8. AnsiString 在 Delphi 中虽然不可用,但是,在 C++ 中可以用
  9. 调试时a标签禁止跳转方法
  10. nginx+ftp搭建图片服务器(Windows Server服务器环境下)
  11. jmeter通过org.sqlite.JDBC驱动连接db数据库
  12. C语言_简单的阶乘函数
  13. 携程Android App的插件化和动态加载框架
  14. Java 锁优化
  15. P1880 [NOI1995]石子合并(区间DP)
  16. 《Head First 设计模式》例子的C++实现(5 单例模式)
  17. 【基本知识】Flume基本环境搭建以及原理
  18. C#动态显示时间
  19. HDU2255(KB10-K 二分图最大权匹配)
  20. Android开发 sharesdk分享微信/朋友圈的时候只显示文字,不显示链接

热门文章

  1. Mindjet MindManager 2012 从模板创建出现“Runtime Error pure virtual function call” 解决方法
  2. 【elasticsearch】(1)centos7 使用yum安装elasticsearch 2.X
  3. iphone5手机端内容超出iphone6没问题且超出内容为http://.....网址
  4. BOM 之 location
  5. [CSS]float&clear浮动
  6. git的使用方法总结
  7. RHEL 7特性说明(六):集群
  8. 学习Swift--枚举的初步认识 --个人备忘 大神勿喷
  9. Python学习笔记(一)Python安装及环境变量的配置
  10. SQL server 连接查询