問題描述:
問卷星自動(dòng)填寫表單
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.分析表單結(jié)構(gòu),寫出js代碼
2.chorme中ctrl+shift+J調(diào)出console,將結(jié)束代碼粘貼進(jìn)去奥喻,執(zhí)行