<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
  <script language="javascript" >
  function abc(){
      var sex=document.getElementsByName("userSex");//不能getElementById,ById又只会读数组第一个值
      for(var i = 0; i < sex.length; i++)
      {
          if(sex[i].checked){
              alert(sex[i].value);
		  }
      }
   }
  </script>
 </HEAD>

 <BODY>
  <input id="userSex" name="userSex" type="radio" value="0" checked="checked" />
  <span class="style1">男</span>
  <input id="userSex" name="userSex" type="radio" value="1" />
  <span class="style1">女</span>
  <input id="userSex" name="userSex" type="radio" value="2" />
  <span class="style1">保密</span>

  <input type="button" onClick="abc()" value="取值">
 </BODY>
</HTML>




黑色头发:http://heisetoufa.iteye.com/