通过使用ul和div来,借助于jquery来实现选项卡的显示与隐藏
$(document).ready(function (e) {
$(‘.tab‘).each(function (e) {
if (e == 0)
$(this).show();//首次加载的时候默认显示第一个
else
$(this).hide();
});
})
//给每一个atab绑定单击事件
$(‘.atab‘).bind(‘click‘, function () {
$(‘.tab‘).hide();//隐藏所有内容
var attr = $(this).attr(‘id‘);
var id = ‘#‘ + attr.substring(1, attr.length);
$(id).show();//显示当前选中项
});
原文:http://www.cnblogs.com/itboy-2009/p/4248236.html