這裏是我的html:的Javascript選擇合適的元素
<div id="TAB_CLIENTPANE" class="panel_tabs k-widget k-header k-tabstrip" style="height: 328px;" data-role="tabstrip" tabindex="0" role="tablist" aria-activedescendant="TAB_CLIENTPANE_ts_active">
<ul class="k-tabstrip-items k-reset">
<li class="k-item k-state-default k-tab-on-top k-state-active k-first" role="tab" aria-controls="TAB_CLIENTPANE-1" aria-selected="true">
<span class="k-link">Summary Report</span>
<a class="tab_win k-button"><span class="k-icon k-i-maximize"></span></a>
<a class="tab_close k-button"><span class="k-icon k-i-close"></span></a>
</li>
<li class="k-item k-state-default k-last" role="tab" aria-controls="TAB_CLIENTPANE-2">
<span class="k-link">Profit Report</span>
<a class="tab_win k-button"><span class="k-icon k-i-maximize"></span></a>
<a class="tab_close k-button"><span class="k-icon k-i-close"></span></a>
</li>
</ul>
<div class="k-content k-state-active" style="display: block; height: 290px;" aria-expanded="true" role="tabpanel" id="TAB_CLIENTPANE-1">
<div id="POSITIONREPORT" data-role="grid" class="k-grid k-widget k-secondary" style="height: 288px;">
<!--lots of divs etc-->
</div>
</div>
<div class="k-content" style="display: none; height: 290px;" aria-hidden="true" aria-expanded="false" role="tabpanel" id="TAB_CLIENTPANE-2">
<div id="PROFITREPORT" data-role="grid" class="k-grid k-widget k-secondary" style="height: 288px;">
<!--lots of divs etc-->
</div>
</div>
</div>
我想寫的作品如下面的描述中說明的方法:
function get_li(id_of_div){
// the parameter id_of_div will be the id of divs,
// eg: "POSTIONREPORT", "PROFITREPORT" etc.
// let's say the parameter passed to the function is "PROFITREPORT"
// PROFITREPORT is the second div after the ul element, so
// the function has to return the second li element of the ul
}
我如何有選擇權立?
由於提前,
你能編輯HTML嗎?我的意思是你可以給你的'LI'元素分配一些'ID'或者額外的類嗎? –