IEWebBrowser组件用法

【转】---由于转载的文章,也是别人转载的,不知道原文地址,敬请作者原谅!仅留作参考

1.打开

        <input name="Button" onClick="document.all.WebBrowser.ExecWB(1,1)"
             type="button" value="打开">
         <OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0"
             id="WebBrowser" width="0"></OBJECT>

    2.另存为

        <input name="Button" onClick="document.all.WebBrowser.ExecWB(4,1)"
             type="button" value="另存为">
         <OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0"
             id="WebBrowser" width="0"></OBJECT>

    3.属性

        <input name="Button" onClick="document.all.WebBrowser.ExecWB(10,1)"
             type="button" value="属性">
         <OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0"
             id="WebBrowser" width="0"></OBJECT>

    4.打印

        <input name="Button" onClick="document.all.WebBrowser.ExecWB(6,1)"
             type="button" value="打印">
         <OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0"
             id="WebBrowser" width="0"></OBJECT>

    5.页面设置

        <input name="Button" onClick="document.all.WebBrowser.ExecWB(8,1)"
             type="button" value="页面设置">
         <OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0"
             id="WebBrowser" width="0"></OBJECT>

    6.刷新

        <input type="button" value="刷新" name="refresh" οnclick="window.location.reload()">

    7.导入收藏

        <input type="button" name="Button" value="导入收藏夹"
             onClick="window.external.ImportExportFavorites(true,);">

    8.导出收藏

        <input type="button" name="Button" value="导出收藏夹"
             onClick="window.external.ImportExportFavorites(false,);">

    9.加入收藏

        <input name="Button" οnclick="window.external.AddFavorite(location.href, document.title)"
             type="button" value="加入收藏夹">

    10.整理收藏夹

        <input name="Submit" οnclick="window.external.ShowBrowserUI(OrganizeFavorites, null)"
             type="button" value="整理收藏夹">

    11.查看源文件

        <input name="Button" οnclick=window.location = "view-source:" + window.location.href
             type=button" value="查看源文件">

    12.语言设置

        <input name="Button" οnclick="window.external.ShowBrowserUI(LanguageDialog, null)"
             type="button" value="语言设置">

    13.前进

        <input name="Submit" οnclick="history.go(1);" type="submit" value="前进">

    14.后退

        <input name="Submit" οnclick="history.go(-1);" type="submit" value="后退">

     或者

        <input name="Submit" οnclick="history.back();" type="submit" value="后退">

IEWebBrowser组件的execWB方法整理:

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

    2.调用方法

        WebBrowser.ExecWB(nCmdID, nCmdExecOpt)

    3.参数说明

        nCmdID:(其关键词都可以在浏览器的菜单里面找到对应的选项)
                        OLECMDID_OPEN = 1                                                  //打开
                        OLECMDID_NEW = 2                                                   //新建
                        OLECMDID_SAVE = 3                                                  //保存
                        OLECMDID_SAVEAS = 4                                             //另存为
                        OLECMDID_SAVECOPYAS = 5                                   //
                        OLECMDID_PRINT = 6                                                //打印
                        OLECMDID_PRINTPREVIEW = 7                                 //打印预览
                        OLECMDID_PAGESETUP = 8                                     //页面设置
                        OLECMDID_SPELL = 9                                               //
                        OLECMDID_PROPERTIES = 10                                  //属性
                        OLECMDID_CUT = 11                                                 //剪切
                        OLECMDID_COPY = 12                                              //复制
                        OLECMDID_PASTE = 13                                             //粘贴
                        OLECMDID_PASTESPECIAL = 14                               //
                        OLECMDID_UNDO = 15                                               //
                        OLECMDID_REDO = 16                                               //
                        OLECMDID_SELECTALL = 17                                     //全选
                        OLECMDID_CLEARSELECTION = 18                          //
                        OLECMDID_ZOOM = 19                                              //
                        OLECMDID_GETZOOMRANGE = 20                           //
                        OLECMDID_UPDATECOMMANDS = 21                       //
                        OLECMDID_REFRESH = 22                                        //刷新
                        OLECMDID_STOP = 23                                               //停止
                        OLECMDID_HIDETOOLBARS = 24                              //隐藏工具栏
                        OLECMDID_SETPROGRESSMAX = 25                       //
                        OLECMDID_SETPROGRESSPOS = 26                       //
                        OLECMDID_SETPROGRESSTEXT = 27                     //
                        OLECMDID_SETTITLE = 28                                        //
                        OLECMDID_SETDOWNLOADSTATE = 29                  //
                        OLECMDID_STOPDOWNLOAD = 30                          //

        nCmdExecOpt:(此参数一般情况选1即可)

                        OLECMDEXECOPT_DODEFAULT = 0                        //
                        OLECMDEXECOPT_PROMPTUSER = 1                     //
                        LECMDEXECOPT_DONTPROMPTUSER = 2              //
                        OLECMDEXECOPT_SHOWHELP = 3                          //

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值