找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 15333|回复: 2

[问题求助] hta检测窗口是否活动

[复制链接]
发表于 2015-8-19 14:05:22 | 显示全部楼层 |阅读模式
被几个事件搞晕了头
  1. <html>

  2. <head>
  3. <hta:Application
  4.     ID              = "oHTA"
  5.     ContextMenu     = "No"
  6.     Border          = "None"
  7.     ShowInTaskBar   = "No"
  8.     ApplicationName = "192.168.0.251"
  9.     SingleInstance  = "Yes"
  10.     WindowState     = "Maximize"
  11.     Version         = "1.5"
  12.     Scroll          = "No"
  13. >

  14. <script language=vbscript>
  15. Sub focus()
  16.   userid.focus()
  17.   xx.innerText =  "活动"
  18. End Sub
  19. Sub blur()
  20.   xx.innerText =  "不活动"
  21. End Sub
  22. Sub check()
  23.   xx.innerText =  "不活动"
  24. End Sub
  25. </script>

  26. </head>

  27. <body onfocus="focus()" onblur="blur()" style="background:#80BFFF;">

  28. <div style="position:absolute;left:40%;top:30%;">
  29. <label for="userid" style="width:60px;">卡号</label>
  30. <input type="text" id="userid"  style="width:200px;" />
  31. <br /><br />
  32. <label for="userpassword" style="width:60px;">口令</label>
  33. <input type="password" id="userpw" style="width:200px;" />
  34. <br /><br />
  35. <label for="adminpassword" style="width:60px;">管理员</label>
  36. <input type=password id="adminpw" style="width:200px;" />
  37. <br /><br />
  38. <button style="position:absolute;right:0px;" onclick="check()">确定</button>
  39. <br /><br /><br />
  40. <label id="xx" style="width:260px;color:red;font-Weight:bold;"></label>
  41. </div>


  42. </body>

  43. </html>
复制代码
意图:当窗口被关闭或被最小化时,或按开始菜单,窗口不活动时,触发事件
防止别人跳过输入窗口
发表于 2015-8-19 15:36:56 | 显示全部楼层
hta 是不响应 onquit 的
 楼主| 发表于 2015-8-19 16:00:48 | 显示全部楼层
我是用一个vbs保护hta
设置环境变量判断是否为活动窗口
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-17 09:09 , Processed in 0.016653 second(s), 8 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表