// JavaScript Document
//禁用右键、文本选择功能、复制按键
/*
jQuery(function($) {
$(document).bind("contextmenu",function(){return false;});
$(document).bind("selectstart",function(){return false;});
$(document).keydown(function(){return key(arguments[0])});
});
*/
//加入收藏
//加入收藏
function addBookmark(title, url) {
if (document.all)
{
try
{
window.external.addFavorite(url, title);
}
catch (e1)
{
try
{
window.external.addToFavoritesBar(url,title);
}
catch (e2)
{
alert('加入收藏失败,请您使用Ctrl+D进行添加手工加入。')
}
}
}
else if (window.external)
{
window.sidebar.addPanel(url, title,"");
}
else
{
alert('加入收藏失败,请您使用Ctrl+D进行添加手工加入。')
}
}
//设置为首页
//设为首页
function setHome(obj,url){
if (document.all)
{
document.body.style.behavior = 'url(#default#homepage)';
document.body.setHomePage(url);
}
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',url);
}
//页签切换效果
function setTab(name,cursel,n){
for(i=1;i<=n;i++){
var menu=$("#"+name+i);
var con=$("#con_"+name+"_"+i);
if(i==cursel)
{
$(menu).addClass("hover");
$(con).fadeTo("slow", 1);
}
else
{
$(menu).removeClass("hover");
$(con).hide();
}
}
}
//正文字号大中小
//小
//中
//大
function doZoom(fontSizeClass)
{
$("#info_content").removeClass("info_content_small").removeClass("info_content_big").removeClass("info_content_mid");
if(fontSizeClass!="")
{
$("#info_content").addClass("info_content_"+fontSizeClass);
}
}
//iframe自适应高度,此为注册函数,必须放到WEB服务器上访问才能看到效果
//frameID为iframe的ID
//addHeight为修正值,一般为0~30
//minHeight为最小值
function regFrameAutoHeight(frameID,addHeight,minHeight)
{
$("#"+frameID).load(function(){
var mainHeight = $(this).contents().find("body").height()+addHeight;
if(minHeight 0)
{
var screen_w = screen.width;
if(screen_w>1024){ycwb.show();}
var bodyHeight = $(document).height();
var dlHeight = $(".ycwb").height();
var topHeight = $(".ycwb").css("top");
topHeight = topHeight.substring(0,topHeight.length - 2);
topHeight = parseInt(topHeight);
$(window).scroll(function(){
var scrollTop = $(window).scrollTop();
if(scrollTop > (bodyHeight - dlHeight))
{
return false;
}
else
{
if(scrollTop > topHeight)
{
ycwb.stop().animate({top:scrollTop + 50});
}
else
{
ycwb.stop().animate({top:topHeight});
}
}
});
$("#cb1").click(function(){
$("html, body").animate({
scrollTop: 0
}, 1200);
});
}
});
});
$(function(){
var _wrap=$('ul.zjgg');//定义滚动区域
var _interval=3000;//定义滚动间隙时间
var _moving;//需要清除的动画
_wrap.hover(function(){
clearInterval(_moving);//当鼠标在滚动区域中时,停止滚动
},function(){
_moving=setInterval(function(){
var _field=_wrap.find('li:first');//此变量不可放置于函数起始处,li:first取值是变化的
var _h=_field.height();//取得每次滚动高度(多行滚动情况下,此变量不可置于开始处,否则会有间隔时长延时)
_field.animate({marginTop:-_h+'px'},600,function(){//通过取负margin值,隐藏第一行
_field.css('marginTop',0).appendTo(_wrap);//隐藏后,将该行的margin值置零,并插入到最后,实现无缝滚动
})
},_interval)//滚动间隔时间取决于_interval
}).trigger('mouseleave');//函数载入时,模拟执行mouseleave,即自动滚动
});