问题描述:
问卷星自动填写表单
js代码:
var data = {
1: {
'question': 1,
'selections': 'A'
},
2: {
'question': 2,
'selections': 'A'
},
3: {
'question': 3,
'selections': 'A'
},
4: {
'question': 4,
'selections': 'ABCDE'
},
5: {
'question': 5,
'selections': 'A'
},
6: {
'question': 6,
'selections': 'A'
},
7: {
'question': 7,
'selections': 'A'
},
8: {
'question': 9,
'selections': 'ACE'
},
9: {
'question': 10,
'selections': 'AC'
},
length: 9
}
for (var i = 1; i <= data.length; i++) {
console.log(data[i])
let ele = document.getElementById('divquestion' + data[i]['question']).children[1]
// .children[data[i] - 1].children[0].click()
data[i]['selections'].split('').map((x) => {
ele.children[x.charCodeAt(0) - 65].children[0].click()
})
}
步骤
1.分析表单结构,写出js代码
2.chorme中ctrl+shift+J调出console,将结束代码粘贴进去,执行
网友评论