//行高亮
$("tr").mouseover(function(){
$(this).addClass("over");
}).mouseout(function(){
$(this).removeClass("over");
})
//隔行变色
$(".tablesorter tbody tr:even").addClass("even");
$(".tablesorter tbody tr:odd").addClass("odd");
//跳转
window.location.href="url"
//iframe内容
document.getElementById("if").contentWindow.document.getElementById("page_imageuids").value;
//iframe父
jQuery(window.parent.document).find("#windownbg").remove();
window.parent.location.reload();
//open()父
window.opener.location.reload();
//居中
var wnd = $(window),
doc = $(document),
pTop = doc.scrollTop(),
pLeft = doc.scrollLeft();
pTop += (wnd.height() - jQuery("#div").height()) / 2;
pLeft += (wnd.width() - jQuery("#div").width()) / 2;
jQuery("#div").css({top: pTop, left: pLeft});
//拖动
jQuery('#x').mousedown(function(event){
var obj= jQuery(this);
var ox = obj.position().left;
var oy = obj.position().top;
var mx = event.clientX;
var my = event.clientY;
var width = obj.width();
var height = obj.height();
$(document).mousemove(function(event){
if (window.getSelection) {
window.getSelection().removeAllRanges();
} else {
document.selection.empty();
}
var left = Math.max(ox+event.clientX-mx, 0);
var top = Math.max(oy+event.clientY-my, 0);
obj.css({left: left, top: top});
}).mouseup(function(){
$(document).unbind('mousemove');
$(document).unbind('mouseup');
});
});
//获取body高
if ($.browser.msie && $.browser.version < 7) {
var scrollHeight = Math.max(
document.documentElement.scrollHeight,
document.body.scrollHeight
);
var offsetHeight = Math.max(
document.documentElement.offsetHeight,
document.body.offsetHeight
);
if (scrollHeight < offsetHeight) {
return $(window).height();
} else {
return scrollHeight;
}
} else {
return $(document).height();
}
//获取body宽
if ($.browser.msie && $.browser.version < 7) {
var scrollWidth = Math.max(
document.documentElement.scrollWidth,
document.body.scrollWidth
);
var offsetWidth = Math.max(
document.documentElement.offsetWidth,
document.body.offsetWidth
);
if (scrollWidth < offsetWidth) {
return $(window).width();
} else {
return scrollWidth;
}
} else {
return $(document).width();
}
jQuery tab选项卡
$("a.tab").click(function () {
$(".active").removeClass("active");
$(this).addClass("active");
$(".content").hide();
$("#"+$(this).attr("title")).fadeIn();
});