我想要的是,当我单击特定的红色id 单选按钮时,它会向我显示警报,正如您在代码中看到的那样...在我的情况下,它没有发生...问题是什么以及如何对此进行排序?
<form>
What color do you prefer?<br>
<input type="radio" name="colors" id="red">Red<br>
<input type="radio" name="colors" id="blue">Blue
</form>
<script>
if (document.getElementById("red").checked == true) {
alert('working');
}
</script>
慕田峪7331174
繁星点点滴滴
繁花不似锦
相关分类