您现在的位置是:首页 > 电脑技术查询 > web开发

怎么让单选按钮被选种

编辑:chaxungu时间:2022-10-02 23:17:57分类:web开发

如何让单选按钮被选种
我在页面中有一个单选按钮,当我打开这个页面的时候这个按钮就被选种了。

注意:不是简单的使用check属性,和focus()以及select()等方法,是模拟鼠标点它被选种的这么一个动作

请问如何实现谢谢!!!!!!!!!!!

------解决方案--------------------
HTML code<input type='radio' id="a" name="radio" /><input type='radio' id="b" name="radio" /><input type='radio' id="c" name="radio" /><input type='radio' id="d" name="radio" /><p><input type='button' value="选中" onclick="document.getElementById('b').click();";
------解决方案--------------------
HTML code<html><head></head><body onload="document.getElementsByName('group')[0].click()"><input type="radio" name="group" id="g1" onclick="alert(1)"/><input type="radio" name="group" id="g2"/></body></html>