Multiple choice questions, how to judge whether the chosen answer is the correct answer?

I got a set of data, which is to choose the type of question. How can I tell if I have chosen the right one

answera: "Olympic Games"
answerb: "Asian Games"
answerc: "Paralympic Games"
answerd: "University Games"
id: "1772"
question: "faster, higher, stronger is the motto of ().
rights:" A "

Feb.26,2021

judge according to the answer


intercept the value of the key corresponding to the answer, intercept the last element (a ~ b ~ c ~ d) and convert it to uppercase. D) compared with the value value of rights field, true got it right. False got it wrong.


change the data format ~ convenient and convenient ~


A:<input type="radio" name="q1" value="A" title=""><br>
B:<input type="radio" name="q1" value="B" title=""><br>
C:<input type="radio" name="q1" value="C" title=""><br>
D:<input type="radio" name="q1" value="D" title=""><br>
<script>
    window.onload = function (ev) {
        var result = [];
        var radio = document.querySelectorAll('input[type=radio]');
        for (var i = 0; i < radio.length; iPP) {
            radio[i].onchange = function (ev2) {
                console.log(this.value);
                console.log(this.name);
                var request = {key: '', value: ''};
                request.key = this.name;
                request.value = this.value;
                console.log(request);
            }
        }
    };
</script>

you can get ABCD,. Then judge ABCD, ah, it can be more options, or it can be indeterminate choice
in fact, this question has many extensions
the original question can be ABCD, and then randomly change the bit BCDA (but displayed as ABCD, etc.), and then get the choice to judge
in order to simplify the judgment, you can first sort the answers and then compare them with the answer string.


  

I think the easiest way is to write value in the tag and compare it with the answer

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2b318-2ba7d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2b318-2ba7d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?