本文整理了Java中com.gargoylesoftware.htmlunit.javascript.host.Window.custom_eval()
方法的一些代码示例,展示了Window.custom_eval()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.custom_eval()
方法的具体详情如下:
包路径:com.gargoylesoftware.htmlunit.javascript.host.Window
类名称:Window
方法名:custom_eval
[英]Executes the specified script code in the scope of this window. This is used only when eval() is called on a Window other than the starting scope
[中]在此窗口范围内执行指定的脚本代码。仅当在非起始作用域的窗口上调用eval()时,才使用此选项
代码示例来源:origin: net.disy.htmlunit/htmlunit
/**
* Executes the specified script code as long as the language is JavaScript or JScript. Does
* nothing if the language specified is VBScript.
* @param script the script code to execute
* @param language the language of the specified code ("JavaScript", "JScript" or "VBScript")
* @see <a href="http://msdn.microsoft.com/en-us/library/ms536420.aspx">MSDN documentation</a>
* @return this method always returns <code>null</code>, like Internet Explorer
*/
public Object jsxFunction_execScript(final String script, final Object language) {
final String languageStr = Context.toString(language);
if (language == Undefined.instance
|| "javascript".equalsIgnoreCase(languageStr) || "jscript".equalsIgnoreCase(languageStr)) {
custom_eval(script);
return null;
}
else if ("vbscript".equalsIgnoreCase(languageStr)) {
LOG.warn("VBScript not supported in Window.execScript().");
}
else {
// Unrecognized language: use the IE error message ("Invalid class string").
throw Context.reportRuntimeError("Invalid class string");
}
return null;
}
代码示例来源:origin: org.jvnet.hudson/htmlunit
/**
* Executes the specified script code as long as the language is JavaScript or JScript. Does
* nothing if the language specified is VBScript.
* @param script the script code to execute
* @param language the language of the specified code ("JavaScript", "JScript" or "VBScript")
* @see <a href="http://msdn.microsoft.com/en-us/library/ms536420.aspx">MSDN documentation</a>
* @return this method always returns <code>null</code>, like Internet Explorer
*/
public Object jsxFunction_execScript(final String script, final Object language) {
final String languageStr = Context.toString(language);
if (language == Undefined.instance
|| "javascript".equalsIgnoreCase(languageStr) || "jscript".equalsIgnoreCase(languageStr)) {
custom_eval(script);
return null;
}
else if ("vbscript".equalsIgnoreCase(languageStr)) {
LOG.warn("VBScript not supported in Window.execScript().");
}
else {
// Unrecognized language: use the IE error message ("Invalid class string").
throw Context.reportRuntimeError("Invalid class string");
}
return null;
}
代码示例来源:origin: org.jenkins-ci/htmlunit
/**
* Executes the specified script code as long as the language is JavaScript or JScript. Does
* nothing if the language specified is VBScript.
* @param script the script code to execute
* @param language the language of the specified code ("JavaScript", "JScript" or "VBScript")
* @see <a href="http://msdn.microsoft.com/en-us/library/ms536420.aspx">MSDN documentation</a>
* @return this method always returns <code>null</code>, like Internet Explorer
*/
public Object jsxFunction_execScript(final String script, final Object language) {
final String languageStr = Context.toString(language);
if (language == Undefined.instance
|| "javascript".equalsIgnoreCase(languageStr) || "jscript".equalsIgnoreCase(languageStr)) {
custom_eval(script);
return null;
}
else if ("vbscript".equalsIgnoreCase(languageStr)) {
LOG.warn("VBScript not supported in Window.execScript().");
}
else {
// Unrecognized language: use the IE error message ("Invalid class string").
throw Context.reportRuntimeError("Invalid class string");
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!