接触JQUERY不太久,这是一个处理TAB标签切换的函数,基于click事件,mouseover事件稍作修改即可 /*tab切换函数 * tabid: tab标签父节点ID * arguments[1]: 活动标签classname,默认为:on * arguments[2]:内容父节点ID,默认为:tabid_con * DEMO: $.tab(tabid); */ jQuery.tab = function(tabid){ var clson = chkp(arguments[1])?arguments[1]:"on"; var conid = chkp(arguments[2])?arguments[2]:tabid+"_con"; $("#"+tabid).children().each(function(i){ $(this).click(function(){ $(this).addClass("on").siblings().removeClass("on"); $("#"+conid).children().eq(i).show().siblings().hide(); }) }) }