hta实现的定时重启或关闭计算机的小工具
来源:188金宝搏地址 阅读:750 次 日期:2016-06-15 10:05:17
温馨提示:188金宝搏地址 小编为您整理了“hta实现的定时重启或关闭计算机的小工具”,方便广大网友查阅!

<!--

/*-------------------------------------------------------------------------------

description:一个用于定时重启或关闭计算机的小工具,适用于windows 2k/xp/2003

author:十一狼

email:112183883@163.com

qq:112183883

website:http://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>

<!--

$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+秒;

                                     }

                                     getobject(left).innerhtml=$oper_str;

                                     document.title=$titl_str;

                                     $time=$time-1;

                                     $o=settimeout(timer_kernel(),1000);

                             }

                             else {

                                     $flag=;

                                     if ($operation==rwin) {

                                                 $flag=6;         //6为重启操作系统

                                     }

                                     else {

                                                 $flag=1;         //1为关闭操作系统

                                     }

                                     operatewin32($flag);

                                     getobject(left).innerhtml=<span style=\color:red\>提示:正在执行预定操作!</span>;

                                     document.title=正在执行预定操作;

                             }

                     }

         }

}

function timer_stop() {

         $bl_sleep=false;

         if (isdeclared($o)) { cleartimeout($o); }

         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() {

         $bl_sleep=true;

         $nowtime=;

         $time=getobject(time).value;

         $mod_time=getobject(mod_time).value;

         $operation=getradioval(operation);

         if (isnan($time) || $time==) {

                     alert(请正确设定一个时间值!     );

                     getobject(time).select();

                     return;

         }

         else {

                     $time=$time.parseint();

                     if ($mod_time==mod_minute) { $time=$time*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($downflag) {

         $os_pro=getobject(winmgmts:{(shutdown)}//./root/cimv2).execquery(select * from win32_operatingsystem where primary=true);

         for ($e=new enumerator($os_pro);!$e.atend();$e.movenext()) {

                     $getprocess=$e.item()

                     $getprocess.win32shutdown($downflag);

         }

}

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>

</body>

</html> 

更多信息请查看脚本栏目
188金宝搏地址 手机网站地址:hta实现的定时重启或关闭计算机的小工具
由于各方面情况的不断调整与变化,188金宝搏地址 提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!

2025国考·省考课程试听报名

  • 报班类型
  • 姓名
  • 手机号
  • 验证码
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 新媒体/短视频平台 | 手机站点 | 投诉建议
工业和信息化部备案号:滇ICP备2023014141号-1 云南省教育厅备案号:云教ICP备0901021 滇公网安备53010202001879号 人力资源服务许可证:(云)人服证字(2023)第0102001523号
云南网警备案专用图标
联系电话:0871-65099533/13759567129 获取招聘考试信息及咨询关注公众号:hfpxwx
咨询QQ:1093837350(9:00—18:00)版权所有:188金宝搏地址
云南网警报警专用图标
Baidu
map