为什么单选按钮 document。getelementbyid()取值会有问题红色部分
程序代码:
<input name="option" type="radio" value="1" checked="checked"/> <input type="radio" name="option" value="2" /> <input type="radio" name="option" value="3" /> <input name="option1" type="radio" value="1" /> <input type="radio" name="option2" value="2" /> <input type="radio" name="option3" value="3" /> <script language="vbscript"> function pk() document.getElementById("option1").checked = false document.getElementById("option2").checked = false document.getElementById("option3").checked = false dim x,y,a,w randomize x = int(rnd()*3)+1 select case x case 1 document.getElementById("option1").checked = true case 2 document.getElementById("option2").checked = true case 3 document.getElementById("option3").checked = true end select if document.getElementById("option").value =1 and document.getElementById("option").checked = true then y=1 elseif document.getElementById("option").value =1 and document.getElementById("option").checked = true then y=2 else y=3 end if if x - y = -1 or x - y = 2 then msgbox "恭喜你,你赢了 " elseif x - y = 0 then msgbox "打平手" else msgbox "电脑胜出" end if end function </script>