2016-12-08 105 views
0

我的標籤p:commandLink在IE8以上工作不正常(在IE8中工作正常)。Primefaces p:commandLink不能在IE8以上工作?

我XHTML是這樣的:

 <h:head> 
     <script type="text/javascript">​ 
       function show_confirm() { 
       //<![CDATA[ 
        var conf = confirm('Are you sure you want to delete?'); 
         if (conf == true) { 
          document.getElementById("scheduleManagerForm:delrow").click(); 
         } 
        //]]> 
       } 

       function run_the_Job_Confirmation() { 
        //<![CDATA[ 
         var conf = confirm('Are you sure you want to run it now?'); 
          if (conf == true) { 
           document.getElementById("scheduleManagerForm:runrow").click(); 
          } 
         //]]> 
        } 

      </script> 
     </h:head> 

    <body> 
    <h:form>  
    <p:dataTable id="jobSchedules" var="js" value="#{SJBean.listOfJobScheduleDTO}" 
           selectionMode="single" selection="#{SJBean.selectedJobSchedule}" 
           rowSelectListener="#{SJBean.onRowSelect}" 
           rowEditListener="#{SJBean.rowEdit}" onRowEditUpdate="jobSchedules msgs"> 

     <p:column style="width:150px;" headerText="Edit"> 
       <p:rowEditor update="scheduleManagerForm:jobListPanel" oncomplete="location.reload()"/> 
       <p:commandLink styleClass="ui-icon ui-icon-trash" onclick="show_confirm();"> 
         <f:setPropertyActionListener target="#{SJBean.selectedJobSchedule}" value="#{js}" /> 
       </p:commandLink> 
       <p:commandLink styleClass="ui-icon ui-icon-play" onclick="run_the_Job_Confirmation();"></p:commandLink> 
     </p:column> 
      </p:dataTable> 
<h:commandButton id="delrow" value="ok" style="visibility:hidden;"> 
             <f:ajax listener="#{SJBean.deleteRow}" render="msgs jobSchedules"></f:ajax> 
            </h:commandButton> 
            <h:commandButton id="runrow" value="ok" style="visibility:hidden;"> 
             <f:ajax listener="#{SJBean.runTheJob}" render="msgs"></f:ajax> 
            </h:commandButton> 
    </h:form> 
    </body> 

當用戶點擊刪除圖標和show_confirm()不會被觸發(通過把一個調試點在Firefox選中)。

完全相同的代碼在IE 8中執行。 我使用Primefaces 2.2作爲應用程序的組成部分。

+1

至少您需要而不是 –

回答

0

在我的javascript中有一個隱形字符。它在我的文本編輯器(Eclipse中的那個)中是不可見的,但是當我在記事本中打開時,我能夠看到它。 這是禁止它執行JavaScript。刪除它,它現在一切正常。