1:如:下面的resumes.js
function getCurrentTab(id){
//.ad_left_profile_maintitle 是class 用“.”表示$(".className"),在样式stylesheet2.css
如果是有id $("#id")
//
.ad_left_profile_maintitle ul li a.current{
width: 130px;height: 27px;display:block;background: url(../images/profile_main_title1.gif) no-repeat;text-decoration: none;padding-top: 7px;}
//删除(removeClass)这个Class后再加是addClass
$(".ad_left_profile_maintitle>ul>li>a").removeClass("current");
$("#"+id+"").addClass("current");
}
function setCurrentTab(id){
$(".ad_left_menu>ul>li>a").removeClass("current");
$("#"+id+"").addClass("current");
}
2:如下:
隐藏:$("#buttom_botton").css('display','none'); 是对下面的加或显示$("#buttom_botton").css('display','');
<div id="buttom_botton">
<ul>
<li id="save_Item_btn" class="button" style="font-size: 20px;font-weight: bold;">Submit</li>
<li id="preview_item_btn" class="button" style="font-size: 20px;font-weight: bold;margin-left:50px;">Preview</li>
</ul>
</div>
=====================================================
在页面加载数据是用的是 : 在hired my way 有一个cool_places.jsp如下:
<script type="text/javascript">
function loadItems(){
$('#compUrl_error').hide();
var url = 'loadCoolPlacesItems.action';
$.post(url, TipsGrid.draw);
}
加载数据是循环数据:
/**
* Draw Tips Table
*/
function TipsGrid() {}
TipsGrid.tBody = function() {
return $('#tips_tbody');
}
TipsGrid.draw = function(jsonObj) {
TipsGrid.remove();
var items = jsonObj.ITEMS;
for (var i=0; i < items.length; i ++) {
TipsGrid.drawRow(items[i]);
}
}
TipsGrid.drawRow = function(item) {
var tr = '<tr style="border-bottom: 1px solid #F4F4F4; " id="tip_' + item.id + '">';
tr += '<td width="90%">'+
'<div id="cool_places_table_items"><ul class="crain_bottom_content_title">' +item.title+'</ul>'+
'<ul class="crain_bottom_content_description">'+item.textDesc+'</ul>'+
'</div></td>';
tr += '<td width="10%" ><a href="javascript:editCommonItems(' + item.id + ');">Edit</a> <a href="javascript:deleteCommonItem(' + item.id + ');">Delete</a></td>';
tr += '</tr>';
TipsGrid.tBody().append(tr);
}
//加载完要删除tr
TipsGrid.remove = function() {
$('#tips_tbody > tr').remove();
}
</script>
<div class="tab-content default-tab" id="tab1">
<!-- This is the target div. id must match the href of this div's tab -->
<table>
<thead>
<tr>
<th>
Items
</th>
<th>
Actions
</th>
</tr>
</thead>
<tbody id="tips_tbody">
<tr>
<td colspan="2"> Loading data ... </td>
</tr>
</tbody>
</table>
</div>