<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Demo03.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
</head>
<body>
<input type="checkbox" name="fav" value="骂人"/>骂人
<input type="checkbox" name="fav" value="打架"/>打架
<input type="checkbox" name="fav" value="吵架"/>吵架
<input type="checkbox" name="fav" value="爱哭"/>爱哭
<input type="checkbox" name="fav" value="闹人"/>闹人
<input type="button" value="全选" onclick="select1(1)"/>
<input type="button" value="反选" onclick="select1(-1)"/>
<input type="button" value="取消" onclick="select1(0)"/>
</body>
</html>
<script>
function select1(oper){
var arr = document.getElementsByName("fav");
for(var i=0;i<arr.length;i++){
switch(oper){
case 0:
case 1:
arr[i].checked=oper;
break;
case -1:
arr[i].checked=!arr[i].checked;
break;
}
}
}
</script>
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>demo03.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
</head>
<body>
<!--单位:秒-->
剩余时间:
<span id="endtime">5400</span>
</body>
</html>
<script type="text/javascript">
var ID = "endtime";
if (window.ID != null) {
var iTime = document.getElementById(ID).innerText;
var Account;
RunTime();
}
function RunTime() {
var iDay, iHour, iMinute, iSecond;
var Day = "", Hour = "", Minute = "", Second = "", Time = "";
if (iTime >= 0) {
iDay = parseInt(iTime / 24 / 3600);
if (iDay > 0) {
Day = iDay + "天";
}
iHour = parseInt((iTime / 3600) % 24);
if (iHour >0) {
Hour = iHour + "时";
}
iMinute = parseInt((iTime / 60) % 60);
if (iMinute >0 ) {
Minute = iMinute + "分";
}
iSecond = parseInt(iTime % 60);
if (iSecond >0) {
Second = iSecond + "秒";
}
if ((Day == "") && (Hour == "")) {
Time = "<span style='color:darkorange'>" + Minute + Second
+ "</font>";
} else {
Time = "<span style='color:green'>" +Day + Hour + Minute + Second+ "</font>";
}
if (iTime == 0) {
clearTimeout(Account);
Time = "<span style='color:red'>时间到了!</span>";
} else {
Account = setTimeout("RunTime()", 1000);
}
iTime = iTime - 1;
}
document.getElementById(CID).innerHTML = Time;
}
</script>
|