生活随笔
收集整理的這篇文章主要介紹了
问卷星简单自动填写调查问卷
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
這段時間,看到群里很多同學(xué)都在發(fā)鏈接請大家填寫調(diào)查問卷,本文將基于目前使用較多的調(diào)查問卷軟件——問卷星,實現(xiàn)問卷的自動填寫。
功能實現(xiàn):
1、在瀏覽器中添加書簽,在書簽中的地址欄中復(fù)制如下代碼
2、代碼實現(xiàn)
javascript
: void ((function () {var hash
= {}; var a
= document
.evaluate('//input[(@type="radio") and not(@value="0")]//@name', document
, null, XPathResult
.UNORDERED_NODE_SNAPSHOT_TYPE, null); if (a
.snapshotLength
){for (var i
= 0; i
< a
.snapshotLength
; i
++) {if (!(a
.snapshotItem(i
).value
in hash
)) hash
[a
.snapshotItem(i
).value
] = 0;hash
[a
.snapshotItem(i
).value
]++;}for (i
in hash
) {document
.evaluate('//input[(@type="radio") and not(@value="0") and @name="' + i
+ '"]', document
, null, XPathResult
.UNORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(Math
.floor(Math
.random() * hash
[i
])).click();}}var array
= new Array();var as = document
.getElementsByTagName("a");var preName
= "";var change
= false;for(var i
=0; i
< as.length
; i
++){if(as[i
].getAttribute("rel") != null && as[i
].nextSibling
.getAttribute("type") == "checkbox"){var name
= as[i
].nextSibling
.getAttribute("name");var check
= as[i
].nextSibling
.getAttribute("checked");if(check
== "checked"){as[i
].click();}if(preName
== "" || preName
== name
){if(Math
.random() * 10 > 5){as[i
].click();change
= true;}}var next
= as[i
+ 1];if(next
.getAttribute("rel") != null && next
.nextSibling
.getAttribute("type") == "checked" && next
.getAttribute("name") != name
){if(!change
){as[i
].click();}change
= false;}if(i
== as.length
- 1 && !change
){as[i
].click();}preName
= name
;}}var objs
= document
.getElementsByTagName("textarea"); for (var i
= 0; i
< objs
.length
; i
++){objs
[i
].focus(); objs
[i
].value
= "最好的意見就是沒有意見,哈哈哈哈哈哈哈"; objs
[i
].blur(); }var choose
= document
.getElementsByTagName("select");for (var i
= 0; i
< choose
.length
; i
++) {choose
[i
].focus();choose
[i
].value
= "1";choose
[i
].blur(); }})());
function validate(){return true;}
var btn
= document
.getElementById("submit_button");
window
.setTimeout(btn
.click(),2000);
本人學(xué)藝不精,本文腳本取自鏈接: JS實現(xiàn)問卷星自動填問卷腳本,兩秒自動提交
3、復(fù)制問卷星問卷地址,搜索問卷地址
4、在調(diào)查問卷的界面中點擊書簽,即可完成一次問卷自動填寫
問題:如何在各種瀏覽器中尋找地址欄
1、雙核瀏覽器在地址欄中點擊星號,在彈出窗口點擊更多,在地址欄中添加代碼
2、火狐瀏覽器點擊書簽,再點擊管理所有書簽在我的足跡的地址欄中復(fù)制代碼
以上步驟都是經(jīng)過本人驗證有效的,歡迎大家指正。
總結(jié)
以上是生活随笔為你收集整理的问卷星简单自动填写调查问卷的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。