解决方案 »

  1.   

    写标志,在mousedown事件中写一个标志,mouseup事件中清除,这样就可以通过这个标志判断鼠标是否按下了;
      

  2.   

    楼上正解<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>自动打勾选中</title>
    <form name="rolloverbox" class="ppkoabcd">
      <p align="center" onMousedown="fun()" onMouseup="ff()"> 
        <input type="checkbox" id="check1" name="check1"  onMouseover="rollovercheck(this)">
        <input type="checkbox" id="check2" name="check2"  onMouseover="rollovercheck(this)" >
        <input type="checkbox" id="check3" name="check3"  onMouseover="rollovercheck(this)" >
        <input type="checkbox" id="check4" name="check4"  onMouseover="rollovercheck(this)">
         </p>
    </form> 
    <script language="JavaScript">  
        var flg=false;
        function fun(){
           flg=true;
        }
       function ff(){
          flg=false;
        }
        function rollovercheck(obj) {
            var check = obj.id;
            var Ch1 = document.getElementById(check);
            if(flg){
                if (Ch1.checked == true) {
                    Ch1.checked = false;
                }
                else {
                    Ch1.checked = true;
                }
    }
    }  
    </script>