锐英源软件
第一信赖

精通

英语

开源

擅长

开发

培训

胸怀四海 

第一信赖

当前位置:锐英源 / 英语翻译 开源技术 / csEXWB / execScript 和 OnBeforeNavigate2
服务方向
人工智能数据处理
人工智能培训
kaldi数据准备
小语种语音识别
语音识别标注
语音识别系统
语音识别转文字
kaldi开发技术服务
软件开发
运动控制卡上位机
机械加工软件
软件开发培训
Java 安卓移动开发
VC++
C#软件
汇编和破解
驱动开发
联系方式
固话:0371-63888850
手机:138-0381-0136
Q Q:396806883
微信:ryysoft

execScript 和 OnBeforeNavigate2


The execScript method of csEXWB uses IHTMLWindow2.execScript to call a script. And I just noticed that there is a bug in the method that checks ScriptLanguage parameter length, rather thanScriptName parameter, and if length is 0 then it exists the method.

csEXWB的EXECSCRIPT方法使用IHTMLWindow2.execScript调用脚本。而我只是注意到,在此方法里有个bug,它检查ScriptLanguage参数长度,而不是thanScriptName参数,且如果长度为0,那么它在方法内存在。

As for calling scripts, I suggest using InvokeScript method which uses IHTMLDocument.Script object simillar to .NET Webbrowser control. The execScript method should work as well except that you can not pass any arguments to execScript method.

至于调用脚本,我建议使用InvokeScript方法,它采用IHTMLDocument.Script,这和.NET WebBrowser控件类似。该execScript方法传递任何参数正常就能工作。

so, currently execScript will not work in the current build? If not, what changes to which file I need to make in order to correct this?

所以,目前EXECSCRIPT不会在当前构建工作?如果没有,什么样的变化,以我需要为了纠正这种哪些文件?

I'm currently using Windows Vista and IE7.

我目前使用Windows Vista和IE7。

Sample Javascript call: javascript:__doPostBack('NY,412800013,09/15/2007,10010,18,C,165,0',false')- Any of the course links on this page will also do.

示例JavaScript电话:JavaScript的:__ doPostBack('NY,412800013,09 / 15 / 2007,10010,18,C,165,0“,假”) - 任何本页面也会做在球场上的联系。

So what I do is download the URL using an HttpRequest object, take the HTML content and load it into the CSEXWB control using LoadHtmlIntoBrowser and provide the baseUrl ("http://testprep.princetonreview.com/CourseSearch/").

所以我要做的就是下载使用HttpRequest对象的URL,把HTML内容,并使用LoadHtmlIntoBrowser加载到CSEXWB控制和提供的baseUrl(“http://testprep.princetonreview.com/CourseSearch/”)。

The way I've been using execScript (with the ScriptName and ScriptLanguage parameters) is to set the ScriptName parameter to the entire javascript call such as:_csexwb.execScript(false, "javascript:__doPostBack('NY,412800013,09/15/2007,10010,18,C,165,0',false')", "JavaScript");

我一直在使用EXECSCRIPT(用了ScriptName和ScriptLanguage参数)的方法是将了ScriptName参数设置为整​​个JavaScript调用,如:_csexwb.execScript(假“的javascript:__ doPostBack('NY,412800013,09 / 15 / 2007,10010,18,C,165,0'假')“,”JavaScript的“);

This has always worked, and is useful because you don't need to deal with parsing out parameters and dealing with other embeded javascript function calls within the parameters. On the other hand, InvokeScript appears to require you to seperate the javascript function call-name from it's parameters and pass them in seperately.

这一直工作,并且是有用的,因为你不需要处理解析出的参数和处理其他嵌入式javascript函数的参数范围内调用。在另一方面,InvokeScript似乎需要你从它的参数单独的JavaScript函数调用的名称,并通过他们的分开。

At any rate, if the execScript call is failing or exiting early as you suggest, then it makes sense why the OnBeforeNavigate2 event is not being fired, however if the javascript is successfully executing then a postback should generated and a corresponding OnBeforeNavigate2 event.

无论如何,如果EXECSCRIPT调用失败或退出早在你的建议,那么它是有道理的,为什么OnBeforeNavigate2事件不被解雇,但如果JavaScript是成功执行,然后回传应该产生相应的OnBeforeNavigate2事件。

Please replace csEXWB.execScript function with the one below. I tested the method and it does work properly now.

请与下面的替换csEXWB.execScript函数。我测试了此方法,它能正常工作。

public object execScript(bool bTopLevel, string ScriptName, string ScriptLanguage)  {
if ((this.m_WBWebBrowser2 == null) || (ScriptName.Length == 0))          
return null;         
IHTMLDocument2 doc2 = null;      
IHTMLWindow2 win2 = null;         
if (bTopLevel)          
doc2 = m_WBWebBrowser2.Document as IHTMLDocument2;      
else          
doc2 = this.GetActiveDocument();      
if (doc2 == null)          
return null;         
win2 = doc2.parentWindow as IHTMLWindow2;      
if (win2 == null)          
return null;         
//MSDN, JScript is MSHTML default      
if (ScriptLanguage.Length == 0)
ScriptLanguage = "JavaScript";      
return win2.execScript(ScriptName, ScriptLanguage);  }  
///////////////////Call////////////////////////////  
If the page is not frameset then just pass true for the first parameter  
Also, ' character was missing from second parameter. Was false'  
m_CurWB.execScript(true,      
"javascript:__doPostBack('NY,412800013,09/15/2007,10010,18,C,165,0','false')",      
"JavaScript");
友情链接
版权所有 Copyright(c)2004-2021 锐英源软件
公司注册号:410105000449586 豫ICP备08007559号 最佳分辨率 1024*768
地址:郑州大学北校区院(文化路97号院)内