2017-06-21 101 views
4

我想在頁面加載時使用調用動作在AMX頁面中調用Java腳本函數,但它引發異常。 我正在使用以下代碼。 我的js文件包含下面的代碼下面的代碼如何在AMX頁面加載時調用JavaScript函數?

(function(){ 
if (!window.application) window.application = {}; 
DayView.gotoFirstOperation =function(){ 
    var element =document.getElementById('box'); 
    alert('Method exeuted'); 
    if('null' != element){ 
    element.scrollIntoView(); 
    } 
}; })(); 

我在調用操作方法我打電話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的功能?

回答

1

嘗試在amx中添加該代碼:amx頁面: 並記住將您的js文件包含到maf-feature.xml內容列表中。

<amx:verbatim id="v1"> 
<![CDATA[ 
     <script type="text/javascript"> 
      document.onload = myMethod(); 
     </script> 
    ]]> 
</amx:verbatim> 
相關問題