js获得单选按钮显示的文本值

<body> 
<input   type= "radio"   name= "radio1"   value= "1"   onclick= "showText(this)"/> 一号 
<input   type= "radio"   name= "radio1"   value= "2"   onclick= "showText(this)"   /> 二号 
<input   type= "radio"   name= "radio1"   value= "3"   onclick= "showText(this)"/> 三号 
</body> 

<script> 
function   showText(obj) 
{ 
var   textnode   =   obj.nextSibling;   //设置父节点 
alert(textnode.nodeValue);

} 
</script> 

 by波神。

posted @ 2012-03-07 17:06  ahacn  阅读(1125)  评论(0)    收藏  举报