我不想在用户每次足够慷慨地通过投票给我反馈时丢失从用户那里收集的信息。并且代码不完整,但总体思路就在那里。如果这个问题已经得到解决,我深表歉意,但在考虑写这篇文章之前,我环顾四周。
<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>