首页 > 编程 > HTML > 正文

hta 定时关机重启实现代码

2024-08-26 00:15:43
字体:
来源:转载
供稿:网友
代码如下:
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<title>一个用于定时重启或关闭计算机的小工具,适用于Windows 2K/XP/2003 </title>
<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">
<!--
$bl_Sleep=false;
function getObject($obj) {
return(document.getElementById($obj));
}
String.prototype.parseInt=function() {
return(parseInt(this));
}
function getRadioVal($name) {
$oEms=document.getElementsByName($name);
for ($i=0;$i<$oEms.length;$i++) {
if ($oEms[$i].checked) { return($oEms[$i].value); }
}
}
function isDeclared($varName) {
return(typeof($varName)!="undefined");
}
function chStatus($name,$status) {
$ooEms=document.getElementsByName($name);
for ($a=0;$a<$ooEms.length;$a++) {
$ooEms[$a].disabled=$status;
}
}
function window.onload() {
$sWidth=window.screen.width;
$sHeight=window.screen.height;
$aWidth=400;
$aHeight=185;
window.resizeTo($aWidth,$aHeight);
window.moveTo(($sWidth-$aWidth)/2,($sHeight-$aHeight)/2);
document.bgColor="#d4d0c8";
getObject("StopButton").disabled=true;
getObject("left").innerHTML="提示:请选择您想要使用的功能!";
}
function Timer_Quit() {
window.close();
}
function Timer_Kernel() {
if ($bl_Sleep) {
if (isDeclared($time) && isDeclared($mod_time) && isDeclared($operation)) {
if ($time>0) {
$Oper_str="";
$Hint_str="";
$Titl_str="";
if ($operation=="rWin") {
$Oper_str="<span style=/"color:red/">提示:系统计时重启功能已启用,请注意保存!</span>";
}
else {
$Oper_str="<span style=/"color:red/">提示:系统计时关闭功能已启用,请注意保存!</span>";
}
if ($mod_time=="mod_minute") {
$tMinute=($time/60).toString().parseInt();
$tSecond=$time%60;
if ($tMinute!=0) {
if ($tSecond<10) {
$tSecond="0"+$tSecond;
}
$Titl_str="剩余时间:"+$tMinute+"分"+$tSecond+"秒";
}
else {
$Titl_str="剩余时间:"+$tSecond+"秒";
}
}
else {
$Titl_str="剩余时间:"+$time+"秒";
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表