//列高度统一
function heightfix(column, column2, sign, offset) {
var ocol = jquery(column);
var ocol2 = jquery(column2);
if (sign == undefined) {
sign = "+";
}
if (offset == undefined) {
offset = 0;
}
if (ocol.height() > ocol2.height()) {
if (sign == "+") {
ocol2.height(ocol.height() + offset);
} else {
ocol2.height(ocol.height() - offset);
}
}
}
//获得日期
function runglnl(obj) {
var today = new date();
var d = new array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
var dddd = (today.getfullyear() < 100 ? today.getfullyear() + 1900 : today.getfullyear()) +
"年" +
(today.getmonth() + 1) +
"月" +
today.getdate() +
"日";
dddd = dddd + " " + d[today.getday()];
jquery(obj).text(dddd);
}
// 加入收藏代码 start -->
function addfavorite(surl, stitle) {
try {
var ctrl = navigator.useragent;
ctrl = ctrl.tolocalelowercase();
if (document.all || ctrl.match(/msie/) != null || ctrl.match(/trident/) != null) { //ie类浏览器
window.external.addfavorite(surl, stitle);
} else {
if (window.sidebar) { //firfox等浏览器
window.sidebar.addpanel(stitle, surl, "");
} else {
alert("加入收藏失败,请使用ctrl+d进行添加");
}
}
} catch (e) {
alert("加入收藏失败,请使用ctrl+d进行添加");
}
}
// 设为首页代码 start -->
function sethome(thiss, pageurl) {
if (document.all) {
thiss.style.behavior = 'url(#default#homepage)';
thiss.sethomepage(pageurl);
} else if (window.sidebar) {
if (window.netscape) {
try {
netscape.security.privilegemanager.enableprivilege("universalxpconnect");
} catch (e) {
alert(
"该操作被浏览器拒绝,如果想启用该功能,请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");
}
}
var prefs = components.classes['@mozilla.org/preferences-service;1']
.getservice(components.interfaces.nsiprefbranch);
prefs.setcharpref('browser.startup.homepage', pageurl);
} else {
alert('您的浏览器不支持自动自动设置首页, 请使用浏览器菜单手动设置!');
}
}
//针对ie6增加悬停样式
function hover(obj, classname) {
var classname = !classname ? "hover" : classname;
jquery(obj)
.hover(function () { jquery(this).addclass(classname); }, function () { jquery(this).removeclass(classname); });
}
$(document)
.ready(function () {
//返回顶部
var gotop = $('');
$("body").append(gotop);
var winh,
wint;
var winfun = function () {
winh = $(window).height();
wint = $(document).scrolltop();
if (wint > winh) {
gotop.fadein();
} else {
gotop.fadeout();
}
};
gotop.click(function () { $("html, body").animate({ scrolltop: 0 }, 0) });
$(window).scroll(winfun);
//搜索、导航遮罩
var winmark = $('');
$("body").append(winmark);
var showlist = $("[showid]");
var hidebox = $("[hidebox]");
showlist.click(function () {
showlist.not($(this)).removeclass("on");
hidebox.not($(this).attr("showid")).removeclass("show");
if ($(this).hasclass("on")) {
$(this).removeclass("on");
$($(this).attr("showid")).removeclass("show");
winmark.removeclass("show");
} else {
$(this).addclass("on");
$($(this).attr("showid")).addclass("show");
winmark.addclass("show");
}
});
winmark.click(function () {
showlist.removeclass("on");
hidebox.removeclass("show");
$(this).removeclass("show");
});
});
//html5 for ie6/7/8
(function () {
if (!
/*@cc_on!@*/
0) {
return;
}
var e =
"abbr, article, aside, audio, canvas, datalist, details, dialog, eventsource, figure, footer, header, hgroup, mark, menu, meter, nav, output, progress, section, time, video"
.split(', ');
var i = e.length;
while (i--) {
document.createelement(e[i]);
}
})();