<html><head><title>a</title>
<script language=Javascript>
function  che(){
          if (document.all.abc.checked==1)
             {alert('你点击了选框!')}
          else {alert('你没有点击选框')}
           }
</script>
</head>
<body>
<div align="center">
    <input type="checkbox" name="abc" value=1>checkbox
    <input type="button" onclick="che()" name="button" value="go">
</div>
</body>
</html>

解决方案 »

  1.   

    <html><head><title>a</title>
    <script language=javascript>
    <!--  function  che(){
              if (document.all.abc.value==1)
                 {document.all.abc.value=0
                  alert('你点击了选框!')}
              else {document.all.abc.value=1
    alert('你没有点击选框')}
               }
    //-->
    </script>
    </head>
    <body>
    <div align="center">
        <input type="checkbox" id="abc" value=0 onclick="che()" >checkbox</div>
    </body>
    </html>
      

  2.   

    好象该这样吧
    <html><head><title>a</title>
    <script language=javascript>
    <!--  
    function  che(){
              if (document.all.abc.value==1)
                 {document.all.abc.value=0
                  alert('你点击了选框!')}
              else {document.all.abc.value=1
    alert('你没有点击选框')}
               }
    //-->
    </script>
    </head>
    <body>
    <div align="center">
        <input type="checkbox" id="abc" value=0 onclick="che()" >checkbox</div>
    </body>
    </html>
      

  3.   

    换一下更好
    <html><head><title>a</title>
    <script language=javascript>
    <!--  
    function  che(){
              if (document.all.abc.value==1)
                 {document.all.abc.value=0
                  alert('你没有点击选框')}
              else {document.all.abc.value=1
    alert('你点击了选框!')}
               }
    //-->
    </script>
    </head>
    <body>
    <div align="center">
        <input type="checkbox" id="abc" value=0 onclick="che()" >checkbox</div>
    </body>
    </html>
      

  4.   

    能说一下这个
    if (document.all.abc.value==1)
                 {document.all.abc.value=0
                  alert('你没有点击选框')}
              else {document.all.abc.value=1
    alert('你点击了选框!')}
    的过程吗?
    这里我有点不明白为什么要这样处理。
      

  5.   

    原来的onclick用函数替代了,过程相反了啊。
      

  6.   

    <input type=text name=txt onkeyup="this.readOnly=!this.readOnly;"/>
      

  7.   

    错,不好意思。。
    if(document.all.abc.checked==true)
      

  8.   

    对不起,我写错了if (document.all.abc.checked==true)