I have the following code for a poll:
<div id="pollE2">
How's the weather today?<br />
<form>
<input type="radio" name="voteE2" value="a" onclick="VoteNow(this.value)" /> Good
<input type="radio" name="voteE2" value="b" onclick="VoteNow(this.value)" /> Bad
</form>
</div>
Where the "VoteNow" function looks like this (it send the results to the "resultsE2.php" file...):
function VoteNow(int) {
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
} else {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
document.getElementById("pollE2").innerHTML=xmlhttp.responseText; }
}
xmlhttp.open("GET","resultsE2.php?voteE2="+int,true);
xmlhttp.send(); }
When the user chooses one option from the pull, the results show directly, but I want the user to be able to click on a SUBMIT button before doing it.
I tried to use document.getElementById(formID).submit()
but I'm not sure how to incorporate it in the code.
Any suggest
ions?