2010-09-12 90 views
0

以下測試html在該行上創建了一個選項卡式列表(新建,更新,刪除)。以編程方式突出顯示/選擇「dl」項目

當前測試通過javascript/ajax調用更新數據,因此用戶選擇的選項卡不會更改,因爲該頁面不會重新顯示/重新生成。但是,如果我更改了測試,要回調服務器,所以服務器必須重新顯示頁面,我不知道如何突出顯示用戶選擇的選項卡! !

那麼,我怎麼編程突出顯示/選擇一個給定的「dl」元素!

感謝

<dl class="tabs" id="configPane"> 
    <dt id="newterm-page" onclick="location.href='#'"><span>New Term</span></dt> 
<dd>  
    <table class="adminform" width="100%"> 

     <div style="border:1px solid #ccc"> 

      <div> 
       <div style="width:200px;float:left;">Current Terms</div> 
       <div style="width:400px" id="newTerms"><select name="termList" id="termList" class="inputbox" size="1" title="Display List of Current Terms"><option value="1" >Spring</option><option value="2" >Summer</option><option value="3" >Fall</option><option value="9" >Winter</option><option value="10" >Summer I</option><option value="11" >Summer II</option></select></div> 
      </div> 

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

       <div style="width:200px;float:left;">New Term</div> 
      <input size="20" type="text" name="nterm" id="nterm" value="" /> 
      </div> 
      <div><br></div> 
      <div> 
       <input type="button" name="button" value="Create Term" onclick="javascript: createTerm(); return false;"> 

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

</dd> 
<dt id="updateterm-page" onclick="javascript: jt1('update'); return false;"><span>Update Term</span></dt> 
    <dd> 
    <table class="adminform" width="100%"> 
     <div style="border:1px solid #ccc"> 

      <div> 
       <div style="width:200px;float:left;">Select Term to Update</div> 
       <div style="width:400px;" id="updateTerms"><select name="upterm" id="upterm" class="inputbox" size="1" title="Display List of Current Terms"><option value="1" >Spring</option><option value="2" >Summer</option><option value="3" >Fall</option><option value="9" >Winter</option><option value="10" >Summer I</option><option value="11" >Summer II</option></select></div> 

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

      <div> 
       <div style="width:200px;float:left;">Updated Term</div> 
      <input size="20" type="text" name="uterm" id="uterm" value="" /> 
      </div> 
      <div><br></div> 
      <div> 
       <input type="button" name="button" value="Update Term" onclick="javascript: updateTerm(); return false;"> 

      </div> 

     </div> 
    </table> 
</dd> 
<dt id="deleteterm-page" onclick="javascript: jt1('delete'); return false;"><span>Delete Term</span></dt> 
    <dd>  
    <table class="adminform" width="100%"> 
     <div style="border:1px solid #ccc"> 
      <div> 

       <div style="width:200px;float:left;">Select Term to Delete</div> 
       <div style="width:400px;" id="deleteTerms"><select name="delterm" id="delterm" class="inputbox" size="1" title="Display List of Current Terms"><option value="1" >Spring</option><option value="2" >Summer</option><option value="3" >Fall</option><option value="9" >Winter</option><option value="10" >Summer I</option><option value="11" >Summer II</option></select></div> 
      </div> 
      <div><br></div> 
      <div><br></div> 
      <div> 

       <input type="button" name="button" value="Delete Term" onclick="javascript: deleteTerm(); return false;"> 
      </div> 
      <div><br></div> 
     </div> 
    </table> 
    </dd></dl> 

回答

1

有關的URL頁面哈希「#」符號後突出顯示的項目,例如將信息index.php?foo=bar#123。 然後使用javascript檢索信息與location.hash(= '#123')提取數字(例如與子字符串或RegExp)並使用它來突出顯示所需的項目。

相關問題