导语:作为大学生,应该知道,每到学期末,该死的学校就会让你对每个老师在本学期的教学成果进行点评,老师又多吼,每个老师又得评价十几二十个项,评完都得花一个小时啦,所以现在我们要让代码去代替我们的工作。接下来直接上干货。
使用步骤:
1.使用时,直接copy下面代码。
2.进入系统评价页面
3.按下F12(google浏览器),点击console选项,把代码黏贴进去,回车,啪啪啪就搞定了
代码与解析(补充评价版)
var a = document.querySelector('iframe');
var c = document.querySelectorAll("ul.nav>li.top")[3].querySelectorAll("ul.sub>li").length;
status = false;
// callback
function b() {
if (status == "true")
return;
status = true;
if (c == 0) {
a.setAttribute('onload', "javascript:dyniframesize('iframeautoheight');");
a.contentDocument.getElementById("Button2").click();
alert("done");
return;
}
var selects = a.contentDocument.querySelectorAll('table.datelist>tbody>tr>td>select');
for (var i = 0; i < selects.length; i++) {
selects[i].selectedIndex = 1
}
var index = Math.round(Math.random()*(selects.length - 1));
//评价
a.contentDocument.getElementById("pjxx").value='非常好,谢谢老师';
selects[index].selectedIndex = 2;
a.contentDocument.getElementById("Button1").click();
c--;
status = false;
}
a.setAttribute('onload', "javascript:dyniframesize('iframeautoheight');b();");
// start
b();