我试图在 AMX 页面中使用调用操作在页面加载时调用 Javascript 函数,但它抛出异常。 我正在使用以下代码。 我的 js 文件包含以下代码:
(function(){
if (!window.application) window.application = {};
DayView.gotoFirstOperation =function(){
var element =document.getElementById('box');
alert('Method exeuted');
if( 'null' != element){
element.scrollIntoView();
}
}; })();
我的 invoke action 方法我在下面的代码中调用 js 函数:
AdfmfContainerUtilities.invokeContainerJavaScriptFunction(AdfmfJavaUtilities.getFeatureName(), "DayView.gotoFirstOperation", new Object[]{});
我遇到以下异常:
invokeContainerUtilitiesMethod 'invokeContainerJavaScriptFunction' encountered an error[ERROR[oracle.adfmf.framework.exception.AdfException]-JS Response returned a nil response.].
有没有其他方法可以在 AMX 页面加载时调用 js 函数?
请您参考如下方法:
尝试在 amx:facet 页面的 amx:facet 中添加该代码: 并记住将您的 js 文件包含到 maf-feature.xml 内容列表中。
<amx:verbatim id="v1">
<![CDATA[
<script type="text/javascript">
document.onload = myMethod();
</script>
]]>
</amx:verbatim>