CreateTime--2017年9月22日16:30:10

Author:Marydon

js操作浏览器的ExecWB命令

一、准备工作:

以ie浏览器为例,需要更改IE安全级别为:"启用没有标记为安全的ActiveX控件"

IE浏览器-工具菜单选项——Internet选项——安全——Internet——自定义级别——启用没有标记为安全的ActiveX控件

否则,执行时,会报错:找不到成员。

二、用法介绍

WebBrowser.ExecWB(1,1)//打开
WebBrowser.ExecWB(4,1)//;保存网页
WebBrowser.ExecWB(6,1)//直接打印
WebBrowser.ExecWB(7,1)//打印预览
WebBrowser.ExecWB(8,1)//打印页面设置
WebBrowser.ExecWB(10,1)//查看页面属性
WebBrowser.ExecWB(15,1)//撤销
WebBrowser.ExecWB(17,1)//全选
WebBrowser.ExecWB(22,1)//刷新
WebBrowser.ExecWB(45,1)//关闭窗体无提示

三、演示

  3.1 页面需要引入

<object classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0" id="WebBrowser" width="0"></object>

  3.2 按钮操作

<input onclick="document.getElementById('WebBrowser').ExecWB(1,1)" type="button" value="打开">
<input onclick="document.getElementById('WebBrowser').ExecWB(2,1)" type="button" value="关闭所有">
<input onclick="document.getElementById('WebBrowser').ExecWB(4,1)" type="button" value="另存为">
<input onclick="document.getElementById('WebBrowser').ExecWB(6,1)" type="button" value="打印">
<input onclick="document.getElementById('WebBrowser').ExecWB(6,6)" type="button" value="直接打印">
<input onclick="document.getElementById('WebBrowser').ExecWB(7,1)" type="button" value="打印预览">
<input onclick="document.getElementById('WebBrowser').ExecWB(8,1)" type="button" value="打印页面设置">
<input onclick="document.getElementById('WebBrowser').ExecWB(10,1)" type="button" value="查看页面属性属性">
<input onclick="document.getElementById('WebBrowser').ExecWB(17,1)" type="button" value="全选">
<input onclick="document.getElementById('WebBrowser').ExecWB(22,1)" type="button" value="刷新">
<input onclick="document.getElementById('WebBrowser').ExecWB(45,1)" type="button" value="关闭"> 
 

最新文章

  1. Python读取文件内容并将内容插入到SSDB中
  2. Python的时间模块小结(转自:不懂真人)
  3. [转]Linux下的Makefile
  4. JqueryUI-1
  5. 中英文url解码vc++源程序
  6. DELL EqualLogic PS存储硬盘故障数据恢复成功案例分享
  7. windows 操作系统发展过程
  8. 【技能意志矩阵-skill will matrix】工作中究竟是个人能力更重要,还是我们的积极性更能提高我们的业绩?
  9. oracle导出导入数据库
  10. Linux将ActiveMQ修改为自启动
  11. day_11 py 名片管理系统
  12. (简单广搜) Ice Cave -- codeforces -- 540C
  13. Smart/400开发上手5: Cobol开发标准
  14. Java编程的逻辑 (62) - 神奇的序列化
  15. lua -- 商店控制器部分
  16. BZOJ1222 [HNOI2001]产品加工 - 动态规划- 背包
  17. 【Coursera】应用机器学习的建议
  18. Android中用GridView实现九宫格的两种方法(转)
  19. LVS (Linux Virtual Server) 思维导图笔记
  20. MongoDB操作库/表

热门文章

  1. (hdu1007)Quoit Design,求最近点对
  2. 【BZOJ 1815】【SHOI 2006】color 有色图
  3. BZOJ 4589 Hard Nim(FWT+博弈论+快速幂)
  4. [xsy2123]毛毛虫
  5. 【强联通分量缩点】【Tarjan】bzoj1051 [HAOI2006]受欢迎的牛
  6. vue的开发环境搭建命令加图解
  7. python3-开发进阶补充Django中的文件的上传
  8. android:scrollbarStyle属性及滚动条和分割线覆盖问题
  9. Java学习笔记(13)
  10. vm克隆linux系统 后连接网络