HTML Radio Button 示例

   1:  <html>
   2:      <title>
   3:          Vocabulary Test
   4:      </title>
   5:      <script type="text/javascript">
   6:                  function checkAnswer()
   7:                  {
   8:                      if(window.document.Q1.A1[0].checked == true)
   9:                          {
  10:                              document.write("congratulations!");
  11:                          }
  12:                      
  13:                      else
  14:                          {
  15:                              document.write("No.Please try again.");
  16:                          }
  17:                  }
  18:              </script>
  19:          <body>
  20:              
  21:              <form name="Q1">
  22:                  1. SAP is a:<br>
  23:                  
  24:                  <input type="radio" name="A1" value="Answer1" checked>Software company<br>
  25:                  <input type="radio" name="A1" value="Answer2" >Oil company<br>
  26:                  <input type="radio" name="A1" value="Answer3">Steel company<br>
  27:                  <input type="button" name="submit" value="submit" onclick="checkAnswer()">
  28:              </form>
  29:              
  30:              
  31:              
  32:          </body>
  33:      
  34:  </html>

posted on 2012-02-13 21:27  westlifegc  阅读(623)  评论(0)    收藏  举报

导航