转自:http://hi.baidu.com/i7521/blog/item/5b6f5010882ba9f8c2ce7945.html
方法一:
此方法在IE7中测试通过。
<
html
>
<
head
>
<
meta
http-equiv
="Content-Type"
content
="text/html; charset=gb2312"
>
<
title
>
无提关闭窗
</
title
>
</
head
>
<
body
>
<
script
language
="JavaScript"
type
="text/javascript"
>
function
Close()
{
//关闭当前窗口
window.open('','_parent','');
window.close();
}
function
OpenWin(url)
{
//全屏打开窗口,网址 url
window.open(url,'_blank','fullscreen=1');
Close();
}
</
script
>
<
input
type
="button"
value
="关闭"
onclick
="Close();"
/>
</
body
>
</
html
>
方法二:
1·把下面这段代码加到你要执行关闭IE窗口的那桢上:
getURL("javascript
:window.opener=null;window.close();");
2·把下面的代码加到你的那个按钮上:
on(release){
getURL("javascript
:window.opener=null;window.close();");
}
这种不能直接关闭原来点IE打开的窗口的!
<object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">
</object>
<input type="button" name="Button" value="关闭窗口" onClick="document.all.WebBrowser.ExecWB(45,1)">
方法三:
在不是js打开的页面上按window.close(),会有提示框,很烦,现在可以不用了,没有提示框直接关闭窗口。
试试下面代码:
<object id=WebBrowser width=0 height=0 classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2>
</object>
<input type=button name=Button value=关闭窗口 onClick=document.all.WebBrowser.ExecWB(45,1)>
试着改变参数会得到其他一些功能:
WebBrowser.ExecWB(1,1) 打开
WebBrowser.ExecWB(2,1) 关闭现在所有的IE窗口,并打开一个新窗口
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) 关闭窗体无提示
这些只对IE5.5以上版本有效,我是在IE6下测试的,通过的。
分享到:
相关推荐
1.<INPUT onclick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开 name=Button1> 2.<INPUT onclick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为 name=Button2> 3....
<input class="b" name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开> <input class="b" name=Button onClick=document.all.WebBrowser.ExecWB(2,1) type=button value=关闭所有> ...
Set oWindow = WebBrowser1.Document.parentWindow Set oNav = oWindow.navigator Debug.Print oNav.userAgent Set oWindow = Nothing Set oNav = Nothing End Sub 点击Command1浏览网页,点击Command2在立即...
完整获取webBrowser1的Cookie HttpOnly的Cookie
iewebbrowser组件的execwb方法IEWebBrowser组件的execWB方法整理。 1. <object id="WebBrowser" width=0 height=0 classid="CLSID:8856F...WebBrowser.ExecWB nCmdID, nCmdExecOpt, [pvaIn], [pvaOut] 3. 参数说明。
WebBrowser.Document.InvokeScript()方法声称提供了一种与WebBrowser HTML文档中JavaScript代码进行交互的方法。 但是,试图弄乱我无法控制的第三方JavaScript(意思是:包含在我无法更改的外部网页中),...
c# 桌面应用 WebBrowser 是IE浏览器内核,目前很多网站不支持了,从国外网站找到一个 谷歌内核的WebBrowser 名字叫 EO.WebBrowser ,比较好用,本文档是他的帮助文档。
EO.WebBrowser免安装dll.C# VB直接饮用版本,你懂得
INPUT onclick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开 name=Button1> 2.<INPUT onclick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为 name=Button2> 3.<INPUT ...
EO.WebBrowser最新版本(v23.4.26)免安装dll.C# 直接引用版本。 EO.WebBrowser,就是给.NET用的Chrome浏览器内核,可以在WinForm中嵌入Chrome浏览器,客户端不用安装浏览器都可以。 无缝集成chrome浏览器引擎和.net...
vs2010+CSerialPortv4.1.0.201010+webbrowser控件实现百度地图(在线和离线)定位
Webbrowser1获取网页源码,实例
If WebBrowser1.Document Is Nothing Then Return End If Try Dim scrollWidth As Integer Dim scrollHeight As Integer scrollHeight = WebBrowser1.Document.Body.ScrollRectangle.Height scrollWidth = ...
bux3 parser no comment ask if need to e-mail
NuGet Gallery | EO.WebBrowser for .NET 16.2.37 https://www.nuget.org/packages/EO.WebBrowser/ 出自 .NET Google 浏览器内核 Eo.Webbrowser | Flyヽ Blog http://lfei.org/net-eo-webbrowser/
MvvmCross WebBrowser插件 提供用于显示网页的跨平台UI。安装使用软件包管理器安装此库。 Install-Package SByteDev.MvvmCross.Plugins.WebBrowser用法using SByteDev . MvvmCross . Plugins . WebBrowser ;await ...
【实例简介】 涵盖了几种常用的 webBrowser执行javascript的方法, execScript方式: NavigateScript方式: ...例如: webBrowser1.Document.InvokeScript("getPwd", new object[] { "18780110000" })
页面设置和打印预览如下所示,直接调用即可document.all.WebBrowser.ExecWB(6,6) 直接打印document.all.WebBrowser.ExecWB(8,1) 页面设置document.all.WebBrowser.ExecWB(7,1) 打印预览或者:execScript("document....
VB编程WebBrowser控件开发经典代码Classic VB programming code WebBrowser Control Development
document.all.WebBrowser.ExecWB(8,1) 页面设置 document.all.WebBrowser.ExecWB(7,1) 打印预览 3 隐藏不打印的页面元素和分页 CSS 有个Media 属性,可以分开设置打印和显示的格式。 如 <style media="print...