<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>test_0803</title> <mce:script type="text/javascript"><!-- function getDateTime(){ var theTime = new Date(); var year = theTime.getYear(); var month = theTime.getMonth()+1; var day = theTime.getDate(); var hour = theTime.getHours(); var minute = theTime.getMinutes(); var seconds = theTime.getSeconds(); if(year<1999){ year+=1900; } month = month<=9?'0'+month:month; day = day<=9?'0'+day:day; hour = hour<=9?'0'+hour:hour; minute = minute<=9?'0'+minute:minute; seconds = seconds<=9?'0'+seconds:seconds; var now = year+"-"+month+"-"+day+" "+hour+":"+minute+":"+seconds; document.getElementById("showTime").innerHTML = now; return; } setInterval("getDateTime()",1000); //------------------------------------// function chkAll(formObj){ var chk = document.getElementsByName("chk[]"); var len = chk.length; for(var i=0; i<len;i++){ chk[i].checked = true; } return; } function unChkAll(formObj){ var chk = document.getElementsByName("chk[]"); var len = chk.length; for(var i=0; i<len;i++){ chk[i].checked = false; } return; } // --></mce:script> </head> <body> <div id="showTime"></div> <pre> <form name='form1' action=''> <input type='checkbox' name='chk[]' > 优秀 <input type='checkbox' name='chk[]' > 良 <input type='checkbox' name='chk[]' > 合格 <input type='checkbox' name='chk[]' > 不合格 <input type="checkbox" name="chk[]" /> 差 <input type='button' value='全选' onClick="chkAll(this.form)" > <input type='button' value='全不选' onClick="unChkAll(this.form)" > </form> </pre> <mce:script type="text/javascript"></mce:script> </body> </html>