2012-04-12 8 views
0

JSFテーブルの行をハイライトしたいとします。これはコードである:JSFページ内の行をハイライト表示していない

<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"  
     xmlns:h="http://java.sun.com/jsf/html" 
     xmlns:f="http://java.sun.com/jsf/core" 
     xmlns:ui="http://java.sun.com/jsf/facelets"> 
    <h:head> 
     <ui:insert name="header">   
      <ui:include src="header.xhtml"/>   
     </ui:insert> 
     <script type="text/javascript" src="resources/js/jquery-1.7.2.min.js"></script> 
    </h:head> 
    <h:body> 

     <h1><img src="resources/css/images/icon.png" alt="NVIDIA.com" /> History Center</h1> 
     <!-- layer for black background of the buttons --> 
     <div id="toolbar" style="margin: 0 auto; width:1180px; height:30px; position:relative; background-color:black"> 
      <!-- Include page Navigation --> 
      <ui:insert name="Navigation">   
       <ui:include src="Navigation.xhtml"/>   
      </ui:insert> 

     </div> 

     <div id="greenBand" class="ui-state-default ui-corner-allh" style="position:relative; top:35px; left:0px;"> 
      <h:graphicImage alt="Dashboard" style="position:relative; top:-20px; left:9px;" value="resources/images/logo_sessions.png" /> 
     </div> 
     <div id="main" style="margin: 0 auto; width:1190px; height:700px; position:absolute; background-color:transparent; top:105px"> 

      <div id="mainpage" style="margin: 0 auto; width:1190px; height:500px; position:absolute; background-color:transparent; top:80px"> 

       <div id="settingsHashMap" style="width:750px; height:400px; position:absolute; background-color:r; top:20px; left:1px"> 

        <h:form id="form"> 

         <!-- The sortable data table --> 
         <h:dataTable id="dataTable" value="#{SessionsController.dataList}" var="item"> 


          <h:column> 
           <f:facet name="header"> 
            <h:commandLink value="Account Session ID" actionListener="#{SessionsController.sort}"> 
             <f:attribute name="sortField" value="Account Session ID" /> 
            </h:commandLink> 
           </f:facet> 
           <h:outputText value="#{item.aSessionID}" /> 
          </h:column> 
          <h:column> 
           <f:facet name="header"> 
            <h:commandLink value="User ID" actionListener="#{SessionsController.sort}"> 
             <f:attribute name="sortField" value="User ID" /> 
            </h:commandLink> 
           </f:facet> 
           <h:outputText value="#{item.userID}" /> 
          </h:column> 
          <h:column> 
           <f:facet name="header"> 
            <h:commandLink value="Activity Start Time" actionListener="#{SessionsController.sort}"> 
             <f:attribute name="sortField" value="Activity Start Time" /> 
            </h:commandLink> 
           </f:facet> 
           <h:outputText value="#{item.activityStart}" /> 
          </h:column> 
          <h:column> 
           <f:facet name="header"> 
            <h:commandLink value="Activity End Time" actionListener="#{SessionsController.sort}"> 
             <f:attribute name="sortField" value="Activity End Time" /> 
            </h:commandLink> 
           </f:facet> 
           <h:outputText value="#{item.activityEnd}" /> 
          </h:column> 
          <h:column> 
           <f:facet name="header"> 
            <h:commandLink value="Activity" actionListener="#{SessionsController.sort}"> 
             <f:attribute name="sortField" value="Activity" /> 
            </h:commandLink> 
           </f:facet> 
           <h:outputText value="#{item.activity}" /> 
          </h:column> 
         </h:dataTable> 

         <!-- The paging buttons --> 
         <h:commandButton value="first" action="#{SessionsController.pageFirst}" 
             disabled="#{SessionsController.firstRow == 0}" /> 
         <h:commandButton value="prev" action="#{SessionsController.pagePrevious}" 
             disabled="#{SessionsController.firstRow == 0}" /> 
         <h:commandButton value="next" action="#{SessionsController.pageNext}" 
             disabled="#{SessionsController.firstRow + SessionsController.rowsPerPage >= SessionsController.totalRows}" /> 
         <h:commandButton value="last" action="#{SessionsController.pageLast}" 
             disabled="#{SessionsController.firstRow + SessionsController.rowsPerPage >= SessionsController.totalRows}" /> 
         <h:outputText value="Page #{SessionsController.currentPage}/#{SessionsController.totalPages}" /> 
         <br /> 

         <!-- The paging links --> 
         <ui:repeat value="#{SessionsController.pages}" var="page"> 
          <h:commandLink value="#{page}" actionListener="#{SessionsController.page}" 
              rendered="#{page != SessionsController.currentPage}" /> 
          <h:outputText value="#{page}" escape="false" 
              rendered="#{page == SessionsController.currentPage}" /> 
         </ui:repeat> 
         <br /> 

         <!-- Set rows per page --> 
         <h:outputLabel for="rowsPerPage" value="Rows per page" /> 
         <h:inputText id="rowsPerPage" value="#{SessionsController.rowsPerPage}" size="3" maxlength="3" /> 
         <h:commandButton value="Set" action="#{SessionsController.pageFirst}" /> 
         <h:message for="rowsPerPage" errorStyle="color: red;" /> 

        </h:form>     

       </div> 

       <div id="settingsdiva" style="width:350px; height:400px; position:absolute; background-color:transparent; top:20px; left:400px"> 

       </div> 

       <div id="settingsdivb" style="width:350px; height:400px; position:absolute; background-color:transparent; top:20px; left:800px"> 

       </div> 
      </div> 
     </div> 

     <script type="text/javascript"> 
       $("tr").not(':first').hover(
       function() { 
       $(this).css("background","#787878"); 
       }, 
       function() { 
       $(this).css("background",""); 
       } 
      ); 
     </script> 


    </h:body> 
</html> 

問題は、私は、列1,2にカーソルを移動して3ときにハイライトが

enter image description here

を動作することであるが、私は4列にカーソルを移動すると、図5および図6では、行は強調表示されていない。

enter image description here

行が強調表示されていない理由を私は見つけられません。間違いを見つけるのを助けてくれますか?

お祈り申し上げます

EDITこれは、クリーンなHTMLコードです:

<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> 
      <title>DX-57 History Center</title> 
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
      <link rel="shortcut icon" type="image/x-icon" href="resources/css/themes/nvidia.com/images/favicon.ico" /> 
      <link href="resources/css/helper.css" media="screen" rel="stylesheet" type="text/css" /> 
      <link href="resources/css/dropdown.css" media="screen" rel="stylesheet" type="text/css" /> 
      <link href="resources/css/default.advanced.css" media="screen" rel="stylesheet" type="text/css" /> 

      <!--[if lt IE 7]&gt; 
      &lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery/jquery.js&quot;&gt;&lt;/script&gt; 
      &lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery/jquery.dropdown.js&quot;&gt;&lt;/script&gt; 
      &lt;![endif]--> 
      <!--/END --> 
     <script type="text/javascript" src="resources/js/jquery-1.7.2.min.js"></script></head><body> 

     <h1><img src="resources/css/images/icon.png" alt="NVIDIA.com" /> History Center</h1> 
     <!-- layer for black background of the buttons --> 
     <div id="toolbar" style="margin: 0 auto; width:1180px; height:30px; position:relative; background-color:black"> 
      <!-- Include page Navigation --> 
      <ul class="dropdown dropdown-horizontal" style="margin: 0 auto"> 
       <li><a href="/SR_57-1.0-SNAPSHOT/UserNav.jsf" class="dir">Home</a> 
        <ul> 
         <li><a href="Dashboard.jsf">Dashboard</a></li> 
        </ul>  
       </li> 
       <li><a href="Sessions.jsf" class="dir">Sessions</a> 
       </li> 
       <li><a href="Application.jsf" class="dir">Application</a> 
        <ul>     
         <li><a href="Glassfish.jsf">Glassfish</a></li> 
        </ul> 
       </li> 
       <li><a href="Linux.jsf" class="dir">Linux</a>     
       </li> 
       <li><a href="Database.jsf" class="dir">Database</a>      
       </li>     
      </ul> 

     </div> 

     <div id="greenBand" class="ui-state-default ui-corner-allh" style="position:relative; top:35px; left:0px;"><img src="resources/images/logo_sessions.png" alt="Dashboard" style="position:relative; top:-20px; left:9px;" /> 
     </div> 
     <div id="main" style="margin: 0 auto; width:1190px; height:700px; position:absolute; background-color:transparent; top:105px"> 

      <div id="mainpage" style="margin: 0 auto; width:1190px; height:500px; position:absolute; background-color:transparent; top:80px"> 

       <div id="settingsHashMap" style="width:750px; height:400px; position:absolute; background-color:r; top:20px; left:1px"> 
<form id="form" name="form" method="post" action="/HM_57-1.0-SNAPSHOT/Sessions.jsf" enctype="application/x-www-form-urlencoded"> 
<input type="hidden" name="form" value="form" /> 


         <!-- The sortable data table --><table id="form:dataTable"> 
<thead> 
<tr> 
<th scope="col"> 
<script type="text/javascript" src="/HM_57-1.0-SNAPSHOT/javax.faces.resource/jsf.js.jsf?ln=javax.faces&amp;stage=Development"></script> 
<a href="#" onclick="mojarra.jsfcljs(document.getElementById('form'),{'form:dataTable:j_idt15':'form:dataTable:j_idt15'},'');return false">Account Session ID</a></th> 
<th scope="col"><a href="#" onclick="mojarra.jsfcljs(document.getElementById('form'),{'form:dataTable:j_idt18':'form:dataTable:j_idt18'},'');return false">User ID</a></th> 
<th scope="col"><a href="#" onclick="mojarra.jsfcljs(document.getElementById('form'),{'form:dataTable:j_idt21':'form:dataTable:j_idt21'},'');return false">Activity Start Time</a></th> 
<th scope="col"><a href="#" onclick="mojarra.jsfcljs(document.getElementById('form'),{'form:dataTable:j_idt24':'form:dataTable:j_idt24'},'');return false">Activity End Time</a></th> 
<th scope="col"><a href="#" onclick="mojarra.jsfcljs(document.getElementById('form'),{'form:dataTable:j_idt27':'form:dataTable:j_idt27'},'');return false">Activity</a></th> 
</tr> 
</thead> 
<tbody> 
<tr> 
<td>1313</td> 
<td>test</td> 
<td>Sun Apr 08 20:21:44 EEST 2012</td> 
<td>Sun Apr 08 20:21:46 EEST 2012</td> 
<td>test 

</td> 
</tr> 
<tr> 
<td>23</td> 
<td>werw</td> 
<td>Tue Apr 10 15:20:14 EEST 2012</td> 
<td>Tue Apr 10 15:20:16 EEST 2012</td> 
<td>23</td> 
</tr> 
<tr> 
<td>231257</td> 
<td>323r</td> 
<td>Tue Apr 10 15:20:51 EEST 2012</td> 
<td>Tue Apr 10 15:21:05 EEST 2012</td> 
<td>23</td> 
</tr> 
<tr> 
<td>231432</td> 
<td>23223r23</td> 
<td>Tue Apr 10 15:20:41 EEST 2012</td> 
<td>Tue Apr 10 15:20:55 EEST 2012</td> 
<td>32r</td> 
</tr> 
<tr> 
<td>232</td> 
<td>test</td> 
<td>Mon Apr 09 15:13:33 EEST 2012</td> 
<td>Mon Apr 09 15:13:37 EEST 2012</td> 
<td>test</td> 
</tr> 
<tr> 
<td>2323165</td> 
<td>2r23r</td> 
<td>Tue Apr 10 15:20:49 EEST 2012</td> 
<td>Tue Apr 10 15:21:04 EEST 2012</td> 
<td>3r</td> 
</tr> 
<tr> 
<td>232337</td> 
<td>3r</td> 
<td>Tue Apr 10 15:20:46 EEST 2012</td> 
<td>Tue Apr 10 15:21:01 EEST 2012</td> 
<td>23</td> 
</tr> 
<tr> 
<td>232388</td> 
<td>323r</td> 
<td>Tue Apr 10 15:20:44 EEST 2012</td> 
<td>Tue Apr 10 15:20:59 EEST 2012</td> 
<td>r</td> 
</tr> 
<tr> 
<td>233222</td> 
<td>32r23r2</td> 
<td>Tue Apr 10 15:20:42 EEST 2012</td> 
<td>Tue Apr 10 15:20:57 EEST 2012</td> 
<td>32r23</td> 
</tr> 
<tr> 
<td>23329</td> 
<td>2323</td> 
<td>Tue Apr 10 15:20:47 EEST 2012</td> 
<td>Tue Apr 10 15:21:02 EEST 2012</td> 
<td>r2</td> 
</tr> 
</tbody> 
</table> 


         <!-- The paging buttons --><input type="submit" name="form:j_idt30" value="first" disabled="disabled" /><input type="submit" name="form:j_idt31" value="prev" disabled="disabled" /><input type="submit" name="form:j_idt32" value="next" /><input type="submit" name="form:j_idt33" value="last" />Page 1/2 
         <br /> 

         <!-- The paging links -->1<a href="#" onclick="mojarra.jsfcljs(document.getElementById('form'),{'form:j_idt36:1:j_idt37':'form:j_idt36:1:j_idt37'},'');return false">2</a> 
         <br /> 

         <!-- Set rows per page --><label for="form:rowsPerPage"> 
Rows per page</label><input id="form:rowsPerPage" type="text" name="form:rowsPerPage" value="10" maxlength="3" size="3" /><input type="submit" name="form:j_idt41" value="Set" /><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="4271939619595356833:-5469736783226522469" autocomplete="off" /> 
</form>     

       </div> 

       <div id="settingsdiva" style="width:350px; height:400px; position:absolute; background-color:transparent; top:20px; left:400px"> 

       </div> 

       <div id="settingsdivb" style="width:350px; height:400px; position:absolute; background-color:transparent; top:20px; left:800px"> 

       </div> 
      </div> 
     </div> 

     <script type="text/javascript"> 
       $("tr").hover(
       function() { 
       $(this).css("background","#787878"); 
       }, 
       function() { 
       $(this).css("background",""); 
       } 
      ); 
     </script></body> 
</html> 
+1

javascripにエラーがある場合は提供できますかコンソール?アドオンなしでFirefoxとChromeで確認できます。ChromeではDeveloper Toolsにあります。あなたのマウスが動いている間にエラーが存在するかどうか、その情報を入れてください –

+1

それはDIVの問題のスタイルのどれですか? – kosa

答えて

0

二DIV層を削除する - あなたはまた、これらのjs関数呼び出しを使用することができますsettingsdiva

2

onmouseover="this.style.cursor='default';this.style.backgroundColor='#F1F1F1';" 
onmouseout="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'" 
関連する問題