在网页中调用IE的内部命令

翻译|其它|编辑:郝浩|2004-01-18 13:56:00.000|阅读 1558 次

概述:

# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>

在IE4+的网页中,使用IE的内部命令,可以实现一些常用的命令:如打印、刷新等。语法如下:

其中:bSuccess是返回值:true 或 false

   sCommand是命令字符串。

   bUserInterface是可选项,true 或 false。

   vValue是可选项,是逻辑值,数字、字符串等[根据命令类型而定]。

例子如下:










代码如下: <script> function test(){ if(document.queryCommandSupported('Print')) alert("支持Print命令!") else alert("不支持Print命令!") } </script> <input onclick="test()" type=button value=测试是否支持该命令><br><br> <input onclick="document.execCommand('print',false,0)" type=button value=打印><br> <input onclick="document.execCommand('SelectAll',false,null)" type=button value=全选><br> <input onclick="document.execCommand('Refresh',false,null)" type=button value=刷新本页><br> <input onclick="document.execCommand('SaveAs',false,'c:\\index.htm')" type=button value=另存为[指定文件名和路径]><br> <input onclick="document.execCommand('SaveAs',false,null)" type=button value=另存为[不指定文件名和路径]><br> <input onclick="document.execCommand('Unselect',false,null)" type=button value=不选[请选定页面上的文字然后按这里]><br> <input onclick="document.execCommand('delete',false,null)" type=button value=删除[请选定页面上的文字然后按这里]>

标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@evget.com


为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP