Js获取radio的值

来源:互联网 发布:淘宝yoyo大美人 编辑:程序博客网 时间:2024/05/16 18:58
<script type="text/javascript">function selectStat(s){var statNode = document.getElementById("stat");statNode.value = s.value;}</script>

<form method="post">您选择你最喜欢的明星是?<br/><input type="radio" name="stat" value="张曼玉" checked="checked" onclick="selectStat(this)" />张曼玉<br/><input type="radio" name="stat" value="林青霞" onclick="selectStat(this)" />林青霞<br/><input type="radio" name="stat" value="凤姐" onclick="selectStat(this)" />凤姐<br/><input type="radio" name="stat" value="阿娇" onclick="selectStat(this)" />阿娇<br/><br/><br/>您选择的是: <input type="text" id="stat" value="张曼玉" readonly/><br/></form>