开发者

How to check radio button on drop select

I have开发者_如何学编程 a radio input that i would like selected when the user select from a drop down. The radio input has a name "rbutton" and id the same. To clarify, I am using html forms. Thanks.


Try using a small bit of javascript.

Here the onclick action on the drop down menu calls the selectRadio function which creates a checked radio button.

<script type="text/javascript">
function selectRadio(){
     document.getElementById('span1').innerHTML = '<input type="radio" checked="true"/>';
}
</script>
<form>
    <p><span id='span1'><input type="radio"/></span> Radio Button</p> 
    <p>Choose option:</p>
    <select onclick='selectRadio()'/>
        <option>1</option>
        <option>2</option>
        <option>3</option>
    </select>
</form>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜