免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2115 | 回复: 1

在WSH中怎么样写InternatExplore的DocumentComplete事件? [复制链接]

论坛徽章:
0
发表于 2012-04-27 15:17 |显示全部楼层

  1. <job id="IncludeExample">
  2.         <script language="JScript" >
  3.                 var ie;
  4.                 ie = WScript.CreateObject("InternetExplorer.Application");
  5.                
  6.                 ie.navigate("os.abc");
  7.                 ie.visible = 1;
  8. //当InternetExplorer的文档加载完毕时,做其它事情
  9.         </script>
  10. </job>
复制代码
请问下怎么写InternetExplorer的DocumentComplete事件,以判断文档的加载情况?

论坛徽章:
0
发表于 2012-04-28 15:18 |显示全部楼层
  1. <job id="IncludeExample">
  2.         <script language="JScript" >
  3.                 var ie;
  4.                 var isQuit = false;
  5.                 function _eventsDocumentComplete(obj,url)//文档加载完毕事件
  6.                 {
  7.                 WScript.Echo("'"+url+"'"+"loaded.");
  8.                 }

  9.                 function _eventsOnQuit()//浏览器退出事件
  10.                 {
  11.                 isQuit = true;
  12.                 }

  13.                 ie = WScript.CreateObject("InternetExplorer.Application","_events");//创建IE实例并设置以_events开头的函数为事件处理函数
  14.                
  15.                 ie.navigate("http://os.abc");//
  16.                 ie.visible = 1;

  17.                 while(!isQuit)
  18.                 {
  19.                 WScript.sleep(100);
  20.                 }
  21.         </script>
  22. </job>
复制代码
问题已解决,代码如上
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP