WebBrowser中点击右键“在新窗口中打开”时,新窗口的Url在哪传递??

Qiao_caT 2007-03-31 12:16:51
Rt...
左键点击时用的StatuText中的Url,
但右键“在新窗口中打开”时,StatuText为空,如何用其他的方法解决?
或怎样捕获右键“在新窗口中打开”时超连接的Url???
...全文
919 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
蒋晟 2007-04-02
  • 打赏
  • 举报
回复
www.codeproject.com/csharp/ExtendedWebBrowser.asp
甴曱 2007-04-01
  • 打赏
  • 举报
回复
BeforeNavigate2是.NET1.0及.NET 1.1下面的事件。

如果在.NET 2.0下。

你测试一下下面这段代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication2
{
public partial class Form1 : Form
{
public WebBrowser WebBrowser
{
get
{
return webBrowser1;
}
set
{
webBrowser1 = value;
}
}

public Form1()
{
InitializeComponent();
}

private void toolStripButton1_Click(object sender, EventArgs e)
{
webBrowser1.Navigate(toolStripTextBox1.Text);
}

private void webBrowser1_NewWindow(object sender, CancelEventArgs e)
{
Form1 f = new Form1();
f.WebBrowser.Navigate(webBrowser1.StatusText);
f.Show();
}
}
}

------------------------------------

namespace WindowsApplication2
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows 窗体设计器生成的代码

/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.webBrowser1 = new System.Windows.Forms.WebBrowser();
this.toolStripTextBox1 = new System.Windows.Forms.ToolStripTextBox();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(657, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripTextBox1,
this.toolStripButton1});
this.toolStrip1.Location = new System.Drawing.Point(0, 24);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(657, 25);
this.toolStrip1.TabIndex = 1;
this.toolStrip1.Text = "toolStrip1";
//
// webBrowser1
//
this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
this.webBrowser1.Location = new System.Drawing.Point(0, 49);
this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
this.webBrowser1.Name = "webBrowser1";
this.webBrowser1.Size = new System.Drawing.Size(657, 292);
this.webBrowser1.TabIndex = 2;
this.webBrowser1.NewWindow += new System.ComponentModel.CancelEventHandler(this.webBrowser1_NewWindow);
//
// toolStripTextBox1
//
this.toolStripTextBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.toolStripTextBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.AllUrl;
this.toolStripTextBox1.Name = "toolStripTextBox1";
this.toolStripTextBox1.Size = new System.Drawing.Size(100, 25);
//
// toolStripButton1
//
this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image")));
this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton1.Name = "toolStripButton1";
this.toolStripButton1.Size = new System.Drawing.Size(23, 22);
this.toolStripButton1.Text = "toolStripButton1";
this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(657, 341);
this.Controls.Add(this.webBrowser1);
this.Controls.Add(this.toolStrip1);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "Form1";
this.Text = "Form1";
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.WebBrowser webBrowser1;
private System.Windows.Forms.ToolStripTextBox toolStripTextBox1;
private System.Windows.Forms.ToolStripButton toolStripButton1;
}
}

Qiao_caT 2007-04-01
  • 打赏
  • 举报
回复
谢谢jiangsheng(蒋晟.Net[MVP]) ,呵呵,刚看了看,2005的WebBrowse没有BeforeNavigate2事件,我还不会写事件,呵呵....
Qiao_caT 2007-04-01
  • 打赏
  • 举报
回复
谢谢cocosoft(),呵呵,怪我没讲清楚,我做的是多页面浏览器,不是要将当前窗口在新窗口中打开,而是在网页中的连接上点击右键"在新窗口中打开",这时截取NewWindow事件,StatuText为空,如果不取消NewWindow事件,就会弹出IE,问题是地址是在哪传递的.
左键点击连接时,StatuText值为所点击连接的地址,就可以直接Navigate了.
Qiao_caT 2007-04-01
  • 打赏
  • 举报
回复
TO: jiangsheng(蒋晟.Net[MVP])
只能用老的axWebBrowser吗??
Qiao_caT 2007-04-01
  • 打赏
  • 举报
回复
To:cocosoft()
谢谢你的代码,试了试,不行呀..
加了个取消事件的语句:
private void webBrowser1_NewWindow(object sender, CancelEventArgs e)
{
Form1 f = new Form1();
f.WebBrowser.Navigate(webBrowser1.StatusText);
f.Show();
e.Cancle = true; //<-------
}

-------------
左键点击能正常生成新页面,右击"在新窗口中打开",新页面就什么都没有了...
没有e.Cancle = true 时,会弹出IE,内容正常啊~~

我QQ:4616809
麻烦加个QQ详聊~~~~~
ylqmf 2007-04-01
  • 打赏
  • 举报
回复
up
蒋晟 2007-04-01
  • 打赏
  • 举报
回复
The webbrowser control in .Net 20 does not support opening new windows in the same application directly. So you need to use the Activex interface.
CathySun118 2007-03-31
  • 打赏
  • 举报
回复
呵呵,网上搜索一下吧,很多资料
蒋晟 2007-03-31
  • 打赏
  • 举报
回复
You need to handle NewWindow2 event to create a new form and handle BeforeNavigate2 event in the new form. The webbrowser control in .Net 20 does not support opening new windows in the same application directly.
甴曱 2007-03-31
  • 打赏
  • 举报
回复
所属的新窗口打开,只是对当前有WebBrowser的窗口进行重新实例化一下,然后,对经过重新实例化的窗口上的WebBrowser控件的NewWindow和WebBrowserNavigating或者WebBrowserNavigated事件赋值。所赋的值与现有的是一样的。当然,你不要将它所传递的值URL定死:)
Qiao_caT 2007-03-31
  • 打赏
  • 举报
回复
回复人:yuan731() ( ) 信誉:100 2007-03-31 16:33:03 得分:0


代码里写Url=""

===================================
问题就在于不知道右键“在新窗口中打开”时所点击连接的Url.....
Qiao_caT 2007-03-31
  • 打赏
  • 举报
回复
谢谢各位,cocosoft() ,能详细些吗?
我用的是2005的WebBrowser,不是老的axWebBrowser,网上资料说这两个控件好像有区别。。。
yuan731 2007-03-31
  • 打赏
  • 举报
回复
代码里写Url=""
甴曱 2007-03-31
  • 打赏
  • 举报
回复
参考:http://www.codeproject.com/csharp/ExtendedWebBrowser.asp
甴曱 2007-03-31
  • 打赏
  • 举报
回复
StatuText的对象问题。如果是自己做浏览器的话,那么它所针对的对象是新打开窗口的StatuText.
JSP编程技巧集锦

需要者请联系:e_mail:fzlotuscn@yahoo.com.cn QQ:595563946

目 录

1. JSP编程常用的js技术
2. 在下拉列表框里选择一个值后跳出新窗口?
3. 在JSP启动execl?
4. 两级下拉列表框联动菜单?
5. java如何把一个目录下的文件移到另一个指定的目录?
6. 制作表格线?
7. jsp如判别一个字符在A到Z之间?
8. 得到一浮点数小数点后4位,如何写以函数截取为两位
9. 整型转字符?
10. 显示数据库的记录,点击哪个标题栏,就按照哪个标题排序
11. 制作两个按钮
12. 用什么sql语句将数据库的一条记录,复制为两条?
13. 有兩個按鈕A,B,其A按下去,A就不可以再按,另外B按下去,A可以再按
請問如何用javascript控制.?
14. jsp的数据库的连接方式
15. 在jsp,怎么实现按回车就可提交表单?
16. 在JSP如何传递数组?
17. 按地址取图片?
18. JSP如何上传图片到数据库字段?
19. 页面自动刷新?
20. 表单自动提交?
21. 从JSP传数据的到JAVABEAN里?
22. weblogic 数据池连接? 数据源 JNDI名字 mysource
23. 三级下拉列表框联动菜单?
24. 在JSP如何调用浏览器的"另存为"功能?
25. 网页全屏显示
26. 求两个日期相隔了多少天:输入间格式为(yyyy-mm-dd)
27. 上传文件对话框
28. 分页测试
29. 下载文件
30. 简单汉字判断
31. 将JSP的变量或者bean传递给JAVASCRIPT使用?
32. 把一种格式(如yyyy-mm-dd)的日期变量转换成另外一种格式(如dd-mm-yyyy)的日期变量!
33. 实现在页面上添加一行输入对话框
34. 制作验证码图片?
35. 图片缩小放大功能
36. 点击输入框弹出日期选择?
37. 在图片上传前查看自己要上传的图片?
38. 在图片排列的页面上选一个图片,然后把它删掉?
39. 显示某目录下的所有文件
40. 把复选框的值直接显示在输入文本框
41. 选择路径下的文件直接显示文件内容?
42. 制作进度条?
43. 对较长字符省略显示?
44. 制作日历?
45. 点击文本弹出一个选择框,选值后返回并显示
46. 关闭框架页面回到没框架的页面?
47. 选多条记录一次性删除?
48. 自动获取页面文件名?
49. 在JSP调用ActiveX控件?
50. 使用SmartUpload实现文件上传?
51. 使用iReport和Jasperreport开发报表?
52. 使用iText生成PDF?
53. 制作图片水印?
54. 在页面屏蔽键盘功能键?
55. 禁止用户复制网页内容?
56. 实现不在地址拦显示当前URL
57. 获取用户的真实IP地址?
58. 获取用户浏览器信息?
59. 获取当前绝对路径?
60. 将HTML文件转换成XML文件?
61. 结合XML和XSL输出HTML页面?
62. 制作动态树型菜单制作?
63. 制作类似QQ的短消息提示?
64. 用jfreechat制作拄、饼、曲线图型?
65. 文本框怎么只容许输入数字?
66. 打开Word和Execl文件?
67. 生成Word 和 Excel文档?
68. JSP如何读取Word内容?
69. 浏览服务器目录/文件?
70. jsp直接弹出下载框下载文件?
71. 配置数据连接池和数据源(Tomcat)?
72. 点击图1变为图2?
73. JSP显示图片的方法之一?
74. int转为Integer的方法?
75. 请求jsp页面禁止缓存方法?
76. select选的值自动到一个文本框?
77. JSP连接数据库?
78. JSP两级下拉列表框联动(数据库)?
79. JSP字符编码问题及转换大全?
80. 使用过滤器设置请求编码?
81. JSP或Servlet调用DLL?
82. 在JSP包含Applet(钟)?
83. 在Applet显示一个html页面?
84. 使session强制失效85. iFreme编辑框使用?
86. Applet与Servlet的通讯?
87. JSP表格直接导入EXCEL?
88. 访问类路径上的资源?
89. 操作文件目录?
90. 获取文件的属性?
91.如何开发并部署一个servlet
92.如何取得配置文件的servlet的参数
93.使servlet成为线程安全的
94.访问标准的CGI变量
95. servlet之间及与jsp间的通讯
96.获取当前绝对路径
97.在servlet操作cookie
98.使用servlet生成JPEG图象
99.在servlet根据请求参数自动填充java对象
100.将jsp应用程序打war包
101.实现投票系统
102.使用cookie记录用户访问次数?
103.使用session对象防止表单重复提交?
104.获取用户真实IP地址?
105.获取请求的所有参数?
106.获取完整的请求URL?
107.在重新显示表单保留用户已经输入的合法数据?
108.使用选代器遍历集合
109.使用特定字符串对一个字符串进行分割?
110.格式化输出数字和字符?
111.生成一定范围的随机数?
112.调用其它应用程序?
113.禁止列出站点文件目录?
114.防止用户直接输入文件名访问JSP?
115.防止表单重复提交?
116.使页面全屏显示?
117.在页面屏蔽鼠标右键?
118.在页面禁止键盘功能键?
119.实现不在地址栏显示当前URL?
120.用javabean方式读取文本文件制作统计图?
121.上传图片并生成缩略图?
122.JS实现图形菜单点击当前图片变另一幅图片?
123.无刷新页面自动刷新?
124.写文件?
125.怎么得到鼠标点击在线图片的位置坐标?
126.页面单线程?
127.数字转
128 自动计算金额
129 JSP页面打印使用WebBrowser控件
130 不刷新页面添加新的类别
131 鼠标滚动缩放图片
132 根据输入的表名生成输入数据表格
133 JSP表格输出到Excel
134.JSP页面输出到带格式的Word文档
135.JSP调用Word打印页面
136.年月日联动选择
137.日期差计算方法
138.文本拷贝
139.字符串转日期
140.计算今天距月底还有几天
Javascript小技巧一箩筐 事件源对象 event.srcElement.tagName event.srcElement.type 捕获释放 event.srcElement.setCapture(); event.srcElement.releaseCapture(); 事件按键 event.keyCode event.shiftKey event.altKey event.ctrlKey 事件返回值 event.returnValue 鼠标位置 event.x event.y 窗体活动元素 document.activeElement 绑定事件 document.captureEvents(Event.KEYDOWN); 访问窗体元素 document.all("txt").focus(); document.all("txt").select(); 窗体命令 document.execCommand 窗体COOKIE document.cookie 菜单事件 document.oncontextmenu 创建元素 document.createElement("SPAN"); 根据鼠标获得元素: document.elementFromPoint(event.x,event.y).tagName=="TD document.elementFromPoint(event.x,event.y).appendChild(ms) 窗体图片 document.images[索引] 窗体事件绑定 document.onmousedown=scrollwindow; 元素 document.窗体.elements[索引] 对象绑定事件 document.all.xxx.detachEvent("onclick",a); 插件数目 navigator.plugins 取变量类型 typeof($js_libpath) == "undefined" 下拉框 下拉框.options[索引] 下拉框.options.length 查找对象 document.getElementsByName("r1"); document.getElementById(id); 定 timer=setInterval("scrollwindow()",delay); clearInterval(timer); UNCODE编码 escape() ,unescape 父对象 obj.parentElement(dhtml) obj.parentNode(dom) 交换表的行 TableID.moveRow(2,1) 替换CSS document.all.csss.href = "a.css"; 并排显示 display:inline 隐藏焦点 hidefocus=true 根据宽度换行 style="word-break:break-all" 自动刷新 简单邮件 快速转到位置 obj.scrollIntoView(true) 锚 anchors 网页传递参数 location.search(); 可编辑 obj.contenteditable=true 执行菜单命令 obj.execCommand 双字节字符 /[^x00-xff]/ 汉字 /[u4e00-u9fa5]/ 让英文字符串超出表格宽度自动换行 word-wrap: break-word; word-break: break-all; 透明背景 获得style内容 obj.style.cssText HTML标签 document.documentElement.innerHTML 第一个style标签 document.styleSheets[0] style标签里的第一个样式 document.styleSheets[0].rules[0] 防止点击空链接,页面往往重置到页首端。 word 上一网页源 asp: request.servervariables("HTTP_REFERER") javascript: document.referrer 释放内存 CollectGarbage(); 禁止右键 document.oncontextmenu = function() { return false;} 禁止保存 地址栏图标 favicon.ico 名字最好不变16*16的16色,放虚拟目录根目录下 收藏栏图标 查看源码 关闭输入法 自动全选 ENTER键可以让光标移到下一个输入框 文本框的默认值 title换行 obj.title = "123 sdfs " 获得间所代表的微秒 var n1 = new Date("2004-10-10".replace(/-/g, "/")).getTime() 窗口是否关闭 win.closed checkbox扁平
获取选内容 document.selection.createRange().duplicate().text 自动完成功能 打开该功能 关闭该功能 窗口最大化 无关闭按钮IE window.open("aa.htm", "meizz", "fullscreen=7"); 统一编码/解码 alert(decodeURIComponent(encodeURIComponent("http://你好.com?as= hehe"))) encodeURIComponent对":"、"/"、";" 和 "?"也编码 表格行指示 //各种尺寸 s += " 网页可见区域宽:"+ document.body.clientWidth; s += " 网页可见区域高:"+ document.body.clientHeight; s += " 网页可见区域高:"+ document.body.offsetWeight +" (包括边线的宽)"; s += " 网页可见区域高:"+ document.body.offsetHeight +" (包括边线的宽)"; s += " 网页正文全文宽:"+ document.body.scrollWidth; s += " 网页正文全文高:"+ document.body.scrollHeight; s += " 网页被卷去的高:"+ document.body.scrollTop; s += " 网页被卷去的左:"+ document.body.scrollLeft; s += " 网页正文部分上:"+ window.screenTop; s += " 网页正文部分左:"+ window.screenLeft; s += " 屏幕分辨率的高:"+ window.screen.height; s += " 屏幕分辨率的宽:"+ window.screen.width; s += " 屏幕可用工作区高度:"+ window.screen.availHeight; s += " 屏幕可用工作区宽度:"+ window.screen.availWidth; //过滤数字 //特殊用途 //不缓存 //正则匹配匹配文字符的正则表达式: [u4e00-u9fa5] 匹配双字节字符(包括汉字在内):[^x00-xff] 匹配空行的正则表达式: [s| ]* 匹配HTML标记的正则表达式:/<(.*)>.*|<(.*) />/ 匹配首尾空格的正则表达式:(^s*)|(s*$)(像vbscript那样的trim函数) 匹配Email地址的正则表达式:w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)* 匹配网址URL的正则表达式:http://([w-]+.)+[w-]+(/[w- ./?%&=]*)? 以下是例子: 利用正则表达式限制网页表单里的文本框输入内容: 用正则表达式限制只能输入文:onkeyup="value=value.replace(/[^u4E00-u9FA5]/g,"")" onbeforepaste="clipboardData.setData("text",clipboardData.getData("text").replace(/[^u4E00-u9FA5]/g,""))" 1.用正则表达式限制只能输入全角字符: onkeyup="value=value.replace(/[^uFF00-uFFFF]/g,"")" onbeforepaste="clipboardData.setData("text",clipboardData.getData("text").replace(/[^uFF00-uFFFF]/g,""))" 2.用正则表达式限制只能输入数字:onkeyup="value=value.replace(/[^d]/g,"") "onbeforepaste="clipboardData.setData("text",clipboardData.getData("text").replace(/[^d]/g,""))" 3.用正则表达式限制只能输入数字和英文:onkeyup="value=value.replace(/[W]/g,"") "onbeforepaste="clipboardData.setData("text",clipboardData.getData("text").replace(/[^d]/g,""))" //消除图像工具栏 or //无提示关闭 function Close() { var ua=navigator.userAgent var ie=navigator.appName=="Microsoft Internet Explorer"?true:false if(ie) { var IEversion=parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE ")))) if(IEversion< 5.5) { var str = "" str += ""; document.body.insertAdjacentHTML("beforeEnd", str); document.all.noTipClose.Click(); } else { window.opener =null; window.close(); } } else { window.close() } } //取得控件得绝对位置(1) <script language="javascript"> function getoffset(e) { var t=e.offsetTop; var l=e.offsetLeft; while(e=e.offsetParent) { t+=e.offsetTop; l+=e.offsetLeft; } var rec = new Array(1); rec[0] = t; rec[1] = l; return rec } //光标停在文字最后 <script language="javascript"> function cc() { var e = event.srcElement; var r =e.createTextRange(); r.moveStart("character",e.value.length); r.collapse(true); r.select(); } //页面进入和退出的特效 进入页面 推出页面 这个是页面被载入和调出的一些特效。duration表示特效的持续间,以秒为单位。transition表示使 用哪种特效,取值为1-23:   0 矩形缩小   1 矩形扩大   2 圆形缩小   3 圆形扩大   4 下到上刷新   5 上到下刷新   6 左到右刷新   7 右到左刷新   8 竖百叶窗   9 横百叶窗   10 错位横百叶窗   11 错位竖百叶窗   12 点扩散   13 左右到间刷新   14 间到左右刷新   15 间到上下   16 上下到间   17 右下到左上   18 右上到左下   19 左上到右下   20 左下到右上   21 横条   22 竖条   23 //网页是否被检索   其属性值有以下一些:   属性值为"all": 文件将被检索,且页上链接可被查询;   属性值为"none": 文件不被检索,而且不查询页上的链接;   属性值为"index": 文件将被检索;   属性值为"follow": 查询页上的链接;   属性值为"noindex": 文件不检索,但可被查询链接;   属性值为"nofollow": //打印分页

page1

page2

//设置打印 <script language=javascript> function window.onload() { // -- advanced features factory.printing.SetMarginMeasure(2) // measure margins in inches factory.printing.SetPageRange(false, 1, 3) // need pages from 1 to 3 factory.printing.printer = "HP DeskJet 870C" factory.printing.copies = 2 factory.printing.collate = true factory.printing.paperSize = "A4" factory.printing.paperSource = "Manual feed" // -- basic features factory.printing.header = "居左显示&b居显示&b居右显示页码,第&p页/共&P页" factory.printing.footer = "(自定义页脚)" factory.printing.portrait = false factory.printing.leftMargin = 0.75 factory.printing.topMargin = 1.5 factory.printing.rightMargin = 0.75 factory.printing.bottomMargin = 1.5 } function Print(frame) { factory.printing.Print(true, frame) // print with prompt }
具体使用手册,更多信息,点这里 //自带的打印预览 WebBrowser.ExecWB(1,1) 打开 Web.ExecWB(2,1) 关闭现在所有的IE窗口,并打开一个新窗口 Web.ExecWB(4,1) 保存网页 Web.ExecWB(6,1) 打印 Web.ExecWB(7,1) 打印预览 Web.ExecWB(8,1) 打印页面设置 Web.ExecWB(10,1) 查看页面属性 Web.ExecWB(15,1) 好像是撤销,有待确认 Web.ExecWB(17,1) 全选 Web.ExecWB(22,1) 刷新 Web.ExecWB(45,1) 关闭窗体无提示
WebBrowser.ExecWB(6,1)> WebBrowser.ExecWB(6,6)> WebBrowser.ExecWB(8,1)>

WebBrowser.ExecWB(7,1)>

//去掉打印的页眉页脚 <script language="JavaScript"> var HKEY_Root,HKEY_Path,HKEY_Key; HKEY_Root="HKEY_CURRENT_USER"; HKEY_Path="\Software\Microsoft\Internet Explorer\PageSetup\"; //设置网页打印的页眉页脚为空 function PageSetup_Null() { try { var Wsh=new ActiveXObject("WScript.Shell"); HKEY_Key="header"; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,""); HKEY_Key="footer"; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,""); } catch(e){} } //设置网页打印的页眉页脚为默认值 function PageSetup_Default() { try { var Wsh=new ActiveXObject("WScript.Shell"); HKEY_Key="header"; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"&w&b页码,&p/&P"); HKEY_Key="footer"; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"&u&b&d"); } catch(e){} } //浏览器验证 function checkBrowser() { this.ver=navigator.appVersion this.dom=document.getElementById?1:0 this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0; this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; this.ie4=(document.all && !this.dom)?1:0; this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; this.ns4=(document.layers && !this.dom)?1:0; this.mac=(this.ver.indexOf("Mac") > -1) ?1:0; this.ope=(navigator.userAgent.indexOf("Opera")>-1); this.ie=(this.ie6 || this.ie5 || this.ie4) this.ns=(this.ns4 || this.ns5) this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns5 || this.ns4 || this.mac || this.ope) this.nbw=(!this.bw) return this; } //计算内容宽和高 //无模式的提示框 function modelessAlert(Msg) { window.showModelessDialog("javascript:alert(""+escape(Msg)+"");window.close();","","status:no;resizable:no;help:no;dialogHeight:height:30px;dialogHeight:40px;"); } //屏蔽按键 屏蔽鼠标右键、Ctrl+N、Shift+F10、Alt+F4、F11、F5刷新、退格键 <script language="Javascript"> //可编辑SELECT //设置光标位置 function getCaret(textbox) { var control = document.activeElement; textbox.focus(); var rang = document.selection.createRange(); rang.setEndPoint("StartToStart",textbox.createTextRange()) control.focus(); return rang.text.length; } function setCaret(textbox,pos) { try { var r =textbox.createTextRange(); r.moveStart("character",pos); r.collapse(true); r.select(); } catch(e) {} } function selectLength(textbox,start,len) { try { var r =textbox.createTextRange(); r.moveEnd("character",len-(textbox.value.length-start)); r.moveStart("character",start); r.select(); } catch(e) {//alert(e.description)} } function insertAtCaret(textbox,text) { textbox.focus(); document.selection.createRange().text = text; } //页内查找 function findInPage(str) { var txt, i, found,n = 0; if (str == "") { return false; } txt = document.body.createTextRange(); for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) { txt.moveStart("character", 1); txt.moveEnd("textedit"); } if (found) { txt.moveStart("character", -1); txt.findText(str); txt.select(); txt.scrollIntoView(); n++; } else { if (n > 0) { n = 0; findInPage(str); } else { alert(str + "... 您要找的文字不存在。 请试着输入页面的关键字再次查找!"); } } return false; } //书 http://www.itpub.net/attachment.php?s=&postid=1894598 http://www.wrclub.net/down/listdown.aspx?id=1341//操作EXECL <script language="javascript"> function jStartExcel() { var xls = new ActiveXObject ( "Excel.Application" ); xls.visible = true; var newBook = xls.Workbooks.Add; newBook.Worksheets.Add; newBook.Worksheets(1).Activate; xls.ActiveWorkBook.ActiveSheet.PageSetup.Orientation = 2; xls.ActiveWorkBook.ActiveSheet.PageSetup.PaperSize = 5; newBook.Worksheets(1).Columns("A").columnwidth=50; newBook.Worksheets(1).Columns("A").WrapText = true; newBook.Worksheets(1).Columns("B").columnwidth=50; newBook.Worksheets(1).Columns("B").WrapText = true; newBook.Worksheets(1).Range("A1:B1000").NumberFormat = "0"; newBook.Worksheets(1).Range("A1:B1000").HorizontalAlignment = -4131; newBook.Worksheets(1).Cells(1,1).Interior.ColorIndex="15"; newBook.Worksheets(1).Cells(1,1).value="First Column, First Cell"; newBook.Worksheets(1).Cells(2,1).value="First Column, Second Cell"; newBook.Worksheets(1).Cells(1,2).value="Second Column, First Cell"; newBook.Worksheets(1).Cells(2,2).value="Second Column, Second Cell"; newBook.Worksheets(1).Name="My First WorkSheet"; } tip <script Language="JavaScript"> //***********默认设置定义.********************* tPopWait=50;//停留tWait豪秒后显示提示。 tPopShow=5000;//显示tShow豪秒后关闭提示 showPopStep=20; popOpacity=99; //***************内部变量定义***************** sPop=null; curShow=null; tFadeOut=null; tFadeIn=null; tFadeWaiting=null; document.write(""); document.write("
"); function showPopupText(){ var o=event.srcElement; MouseX=event.x; MouseY=event.y; if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""}; if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""}; if(o.dypop!=sPop) { sPop=o.dypop; clearTimeout(curShow); clearTimeout(tFadeOut); clearTimeout(tFadeIn); clearTimeout(tFadeWaiting); if(sPop==null || sPop=="") { dypopLayer.innerHTML=""; dypopLayer.style.filter="Alpha()"; dypopLayer.filters.Alpha.opacity=0; } else { if(o.dyclass!=null) popStyle=o.dyclass else popStyle="cPopText"; curShow=setTimeout("showIt()",tPopWait); } } } function showIt(){ dypopLayer.className=popStyle; dypopLayer.innerHTML=sPop; popWidth=dypopLayer.clientWidth; popHeight=dypopLayer.clientHeight; if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24 else popLeftAdjust=0; if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24 else popTopAdjust=0; dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust; dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust; dypopLayer.style.filter="Alpha(Opacity=0)"; fadeOut(); } function fadeOut(){ if(dypopLayer.filters.Alpha.opacity0) { dypopLayer.filters.Alpha.opacity-=1; tFadeIn=setTimeout("fadeIn()",1); } } document.onmouseover=showPopupText; 插入文字"); } } //netscapte下操作xml doc = new ActiveXObject("Msxml2.DOMDocument"); doc = new ActiveXObject("Microsoft.XMLDOM") ->> doc = (new DOMParser()).parseFromString(sXML,"text/xml") //判断键值 <script language="javascript"> var ie =navigator.appName=="Microsoft Internet Explorer"?true:false; function keyDown(e) { if(!ie) { var nkey=e.which; var iekey="现在是ns浏览器"; var realkey=String.fromCharCode(e.which); } if(ie) { var iekey=event.keyCode; var nkey="现在是ie浏览器"; var realkey=String.fromCharCode(event.keyCode); if(event.keyCode==32){realkey="" 空格""} if(event.keyCode==13){realkey="" 回车""} if(event.keyCode==27){realkey="" Esc""} if(event.keyCode==16){realkey="" Shift""} if(event.keyCode==17){realkey="" Ctrl""} if(event.keyCode==18){realkey="" Alt""} } alert("ns浏览器键值:"+nkey+" "+"ie浏览器键值:"+iekey+" "+"实际键为"+realkey); } document.onkeydown = keyDown; //Javascript Document.

请按任意一个键。。。。

//禁止FSO 1.注销组件 regsvr32 /u scrrun.dll 2.修改PROGID HKEY_CLASSES_ROOTScripting.FileSystemObject Scripting.FileSystemObject 3.对于使用object的用户,修改HKEY_CLASSES_ROOTScripting. //省略号
就是比如有一行文字,很长,表格内一行显示不下.
//检测media play版本 //图象按比例 <script language="JavaScript"> //细线SELECT function getComputerName() { var objWMIService = GetObject("Winmgmts:rootcimv2"); for(e = new Enumerator(objWMIService) ; !e.atEnd() ; e.moveNext()) { var getComputer = e.item(); return getComputer.Name; } } //条件编译 <script language=javascript> /*@cc_on @*/ /*@if (@_win32 && @_jscript_version>5) function window.confirm(str) { execScript("n = msgbox(""+ str +"", 257)", "vbscript"); return(n == 1); } @end @*/ //mergeAttributes 复制所有读/写标签属性到指定元素。
This is a sample DIV element.
This is another sample DIV element.
以上内容可以随意转载,转载后请注名来源和出处! 原文链接:http://ttyp.cnblogs.com/archive/2004/11/15/63900.aspx //Import function Import() { for( var i=0; i"); else document.write(""); } }; //js枚举 function getComputerName() { var objWMIService = GetObject("Winmgmts:rootcimv2"); for(e = new Enumerator(objWMIService) ; !e.atEnd() ; e.moveNext()) { var getComputer = e.item(); return getComputer.Name; } } //条件编译 <script language=javascript> /*@cc_on @*/ /*@if (@_win32 && @_jscript_version>5) function window.confirm(str) { execScript("n = msgbox(""+ str +"", 257)", "vbscript"); return(n == 1); } @end @*/ //mergeAttributes 复制所有读/写标签属性到指定元素。
This is a sample DIV element.
This is another sample DIV element.
电子书制作:源码爱好者

111,118

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧