Javascript 无线电值检索

Javascript 无线电值检索,javascript,html,Javascript,Html,我不相信有getElementByValue()方法,但是有没有办法在我的表单中检索“Yes”值 <form> Do you work at Mori Seiki? <br /> <input type ="radio" name = "group1_answers" value = "Yes" /> Yes <br /> <input type ="radio" name = "group1_answers" val

我不相信有getElementByValue()方法,但是有没有办法在我的表单中检索“Yes”值

<form>
    Do you work at Mori Seiki? <br />
    <input type ="radio" name = "group1_answers" value = "Yes" /> Yes <br />
    <input type ="radio" name = "group1_answers" value = "No" /> No <br />
    <input type ="radio" name = "group1_answers" value = "Perhaps" /> Perhaps <br /> 

    Your answer is: <input type ="text" id = "work_answer" />
    <script>
        if(document.getElementByValue('Yes')){   <-- similar function?
            ;
        }
    </script>
</form>

你在森精机工作吗


也许
你的答案是: 如果(document.getElementByValue('Yes'){传递一个to应该可以做到这一点:

var radioButton = document.querySelector('input[value="Yes"]');
传递一个到应该可以做到这一点:

var radioButton = document.querySelector('input[value="Yes"]');