我不想在用户每次慷慨地通过民意测验向我提供反馈时就失去从他们那里收集的信息。 代码并不完整,但总的想法是存在的。 如果这个问题已经解决了,我道歉,但在考虑撰写这一文章之前,我仔细观察了一下。
<script type="text/javascript" src="script.js">
function sendForm() {
var previousPollResults;
// array read from webpage which will be added to.
for (var i=0; i < document.pollForm.choice.length; i++) {
if (document.pollForm.choice[i].checked) {
previousPollResults.choice[i]+=1;
} else {
//nothing
}
}
<form name="pollForm">
<input type="radio" name="choice" value="java" checked />Java<br>
<input type="radio" name="choice" value="webDesign">Web Design<br>
<input type="radio" name="choice" value="blogging" checked />Blogging<br>
<input type="radio" name="choice" value="arduino">Arduino<br>
<input type="radio" name="choice" value="digitalElectronics" checked />Digital Electronics<br>
<input type="radio" name="choice" value="onlineResources">Online Resources <br>
<input type="button" value="send" onclick="sendForm()">
</form>