欢迎光临

木子屋

标题: 定时重启或关机的小工具

作者: dnawo

日期: 2007-07-10 08:54 AM

分类: HTML/CSS

内容: 复制内容到剪贴板 程序代码<!--
/*--------------------Windows Timer---------------------------------------------
Description:一个用于定时重启或关闭计算机的小工具，适用于Windows 2K/XP/2003
Author:十一狼
Email:112183883@163.com
QQ:112183883
WebSite:www.w3cg.net
-------------------------------------------------------------------------------*/
-->
<html>
<head>
<title>♀Windows系统计时器♀</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<hta:application
id="WTimer"
maximizebutton="No"
minimizebutton="Yes"
singleinstance="Yes"
contextmenu="Yes"
sysmenu="Yes"
version="1.0"
innerborder="No"
caption="Yes"
showintaskbar="Yes"
border="Normal"
borderstyle="Normal"
applicationname="Windows Timer"
icon="TimerIco.ico"
/>
<Style type="text/css">
<!--
* { font-family:Courier New,Arial,Sans-serif;font-size:9pt; }
body { overflow-y:hidden; }
div a:link,div a:visited { text-decoration:none;color:#000 }
div a:hover { text-decoration:underline;color:#f00 }
#footerinfo { width:100%;display:table;margin-top:5px; }
#left { float:left;width:70%; }
#right { float:right;width:29%;text-align:right;margin-right:1px; }
-->
</Style>
<Script Language="JavaScript">
<!--
=false;
function getObject() {
return(document.getElementById());
}
String.prototype.parseInt=function() {
return(parseInt(this));
}
function getRadioVal() {
=document.getElementsByName();
for (=0;<.length;++) {
if ([].checked) { return([].value); }
}
}
function isDeclared() {
return(typeof()!="undefined");
}
function chStatus(,) {
=document.getElementsByName();
for (=0;<.length;++) {
[].disabled=;
}
}
function window.onload() {
=window.screen.width;
=window.screen.height;
=400;
=185;
window.resizeTo(,);
window.moveTo((-)/2,(-)/2);
document.bgColor="#d4d0c8";
getObject("StopButton").disabled=true;
getObject("left").innerHTML="提示：请选择您想要使用的功能！";
}
function Timer_Quit() {
window.close();
}
function Timer_Kernel() {
if () {
if (isDeclared() && isDeclared() && isDeclared()) {
if (>0) {
="";
="";
="";
if (=="rWin") {
="<span style=\"color:red\">提示：系统计时重启功能已启用，请注意保存！</span>";
}
else {
="<span style=\"color:red\">提示：系统计时关闭功能已启用，请注意保存！</span>";
}
if (=="mod_minute") {
=(/60).toString().parseInt();
=%60;
if (!=0) {
if (<10) {
="0"+;
}
="剩余时间："++"分"++"秒";
}
else {
="剩余时间："++"秒";
}
}
else {
="剩余时间："++"秒";
}
getObject("left").innerHTML=;
document.title=;
=-1;
=setTimeout("Timer_Kernel()",1000);
}
else {
="";
if (=="rWin") {
=6; //6为重启操作系统
}
else {
=1; //1为关闭操作系统
}
OperateWin32();
getObject("left").innerHTML="<span style=\"color:red\">提示：正在执行预定操作！</span>";
document.title="正在执行预定操作";
}
}
}
}
function Timer_Stop() {
=false;
if (isDeclared()) { clearTimeout(); }
getObject("time").disabled=false;
getObject("mod_time").disabled=false;
chStatus("operation",false);
getObject("StartButton").disabled=false;
getObject("StopButton").disabled=true;
getObject("left").innerHTML="提示：请选择您想要使用的功能！";
document.title="♀Windows系统计时器♀";
}
function Timer_Start() {
=true;
="";
=getObject("time").value;
=getObject("mod_time").value;
=getRadioVal("operation");
if (isNaN() || =="") {
alert("请正确设定一个时间值！ ");
getObject("time").select();
return;
}
else {
=.parseInt();
if (=="mod_minute") { =*60; }
}
getObject("time").disabled=true;
getObject("mod_time").disabled=true;
chStatus("operation",true);
getObject("StartButton").disabled=true;
getObject("StopButton").disabled=false;
Timer_Kernel();
}
function OperateWin32() {
=GetObject("WinMgmts:{(shutdown)}//./root/cimv2").ExecQuery("select * from win32_operatingsystem where primary=true");
for (=new Enumerator();!.atEnd();.moveNext()) {
=.item()
.win32shutdown();
}
}
function ResponseKeyPress() {
if (event.keyCode==13) { event.keyCode=9; }
}
//-->
</Script>
</head>
<body>
<fieldset>
<table width="100%" border="1" cellpadding="4" cellspacing="3">
<form name="form1">
<tr>
<td width="25%">设定时间：</td>
<td width="75%"><input type="text" name="time" size="20" value="" onkeypress="ResponseKeyPress()" />
<select name="mod_time">
<option value="mod_minute">分钟</option>
<option value="mod_second">秒钟</option>
</select>
</td>
</tr>
<tr>
<td>功能选择：</td>
<td>
<input type="radio" name="operation" value="rWin" checked="checked" />重启
<input type="radio" name="operation" value="cWin" />关机
</td>
</tr>
<tr>
<td colspan="2" style="text-align:right">
<input type="button" name="StartButton" value=" 应用 " onclick="Timer_Start()" />
<input type="button" name="StopButton" value=" 取消 " onclick="Timer_Stop()" />
<input type="button" name="ExitButton" value=" 退出 " onclick="Timer_Quit()" />
</td>
</tr>
</form>
</table>
</fieldset>
<div id="footerinfo">
<div id="left"></div>
<div id="right">
作者：<a href="www.w3cg.net" title="访问作者博客">十一狼</a>
</div>
</div>
</body>
</html>
将以上内容保存为hta文件运行即可！

+ 查看当前日志评论 (0)

登录

────────────

木子屋

PJBlog3 v3.2.9.518 Inside.

Processed In 2.592 ms

返回

标题: 定时重启或关机的小工具

你没有权限发表评论

────────────

木子屋

PJBlog3 v3.2.9.518 Inside.

Processed In 2.592 ms

返回

暂无评论

返回

────────────

木子屋

PJBlog3 v3.2.9.518 Inside.

Processed In 2.685 ms

返回