我看其它单位上有个绩效管理的提示窗口,于是把JS文件拿到我电脑上来,调用,结果出错,通过改路径远程调用也出错.
用这名在底部调用的 <script src="/inc/jxtx.js" type="text/javascript"></script> 是从原服务器上复制来的, 我也建了相应的目录 jxtx.js内容如下:
//绩效提醒右下角小窗口
function isLeapYear(){ //判断是否闰年
//能被4整除且不能被100整除
//或
//能被100整除且能被400整除
var pYear=new Date().getFullYear();
if ((pYear%4==0 && pYear%100!=0)||(pYear%100==0 && pYear%400==0)){
return true;
}else{
return false;
}
}
function IsMonthStart(){ //判断月初三个工作日
var theFirst = new Date(new Date().getFullYear() + "/" + (new Date().getMonth()+1) + "/1");
var n = theFirst.getDay();
switch (n){
case 1: case 2: case 3:
if(new Date().getDate()==1 || new Date().getDate()==2 || new Date().getDate()==3){return true;}else{return false;}
break;
case 4:
if(new Date().getDate()==1 || new Date().getDate()==2 || new Date().getDate()==5){return true;}else{return false;}
break;
case 5:
if(new Date().getDate()==1 || new Date().getDate()==4 || new Date().getDate()==5){return true;}else{return false;}
break;
case 6:
if(new Date().getDate()==3 || new Date().getDate()==4 || new Date().getDate()==5){return true;}else{return false;}
break;
case 7:
if(new Date().getDate()==2 || new Date().getDate()==3 || new Date().getDate()==4){return true;}else{return false;}
break;
}
}
function IsMonthEnd(){ //判断月末最后一个工作日
var year = new Date().getFullYear();
var month = new Date().getMonth();
if (isLeapYear()){
var maxDay = new Array(31,29,31,30,31,30,31,31,30,31,30,31);
}else{
var maxDay = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
}
if (new Date(year,month,maxDay[month]).getDay() == 0 ){
var myDay = maxDay[month] - 2;
}else if (new Date(year,month,maxDay[month]).getDay() == 6 ){
var myDay = maxDay[month] - 1;
}else{
var myDay = maxDay[month];
}
if (new Date().getDate() == myDay){
return true;
}else{
return false;
}
}
function IsFri(){ //判断是否周五
var myDate = new Date();
if (myDate.getDay() == 5){
return true;
}else{
return false;
}
}
function showmsg(msg){
document.writeln("<div id=\"reshow\" style=\"position:absolute;right:2px;bottom:2px;font-size:12px; display:none;background-color

b50000; cursor:pointer;border:1px solid #b50000;color:white;padding:4px;\">恢复显示<\/div> ");
document.writeln("<div id=\"jxtxslide\" style=\"width:200px; height:150px; border:1px solid #b50000; position:absolute; bottom:2px; right:2px; display:none; background-color:white;\"> ");
document.writeln("<div style=\"padding-top:4px;background-color

b50000;height:20px;\">");
document.writeln("<a style=\"float:right;font-size:12px; text-decoration:none; color:white;margin-right:6px;\" href=\"javaScript:void(0)\" id=\"close\">关闭<\/a>");
document.writeln("<span style=\"float:right;font-size:12px;color:white;margin-right:66px;\">绩效管理提示信息<\/span>");
document.writeln("<\/div> ");
document.writeln("<div style=\"text-align:left;line-height:120%;font-size:14px;padding:6px;text-indent:2em;color

c60a00;font-family:微软雅黑;font-weight:bold;\">" + msg + "<\/div>");
document.writeln("<div style=\"right:4px;position:absolute;bottom:4px;margin-right:10px;font-size:12px;color

2267b5;\">绩效小秘书<\/div> ");
document.writeln("<\/div> ");
}
function jxtx_display() {
$("#jxtxslide").slideDown("slow");
$("#reshow").hide();
$("#reshow").css({"position":"fixed","z-index":"9999"}).css({"right":"2px","bottom":"2px"});
$("#jxtxslide").css({"position":"fixed","z-index":"9999"}).css({"right":"2px","bottom":"2px"});
/*ie6需要动态设置距顶端高度top.*/
if($.browser.msie && $.browser.version == 6) {
$("#jxtxslide").css('position','absolute');
$("#reshow").css('position','absolute');
$(window).scroll(function(){
var topIE6;
var topIE6_1;
topIE6=$(window).scrollTop() + $(window).height() - $("#jxtxslide").outerHeight() -2;
topIE6_1=$(window).scrollTop() + $(window).height() - $("#reshow").outerHeight() -2;
$("#jxtxslide").css( 'top' , topIE6 );
$("#reshow").css( 'top' , topIE6_1 );
});
}
}
if (IsMonthEnd() && IsFri()){
//alert('月末和周五');
var str = "亲,月末和周末撞车了哈,绩效监控的周记录和下月计划写了没?别怪我没提醒你呦!";
showmsg(str);
}else if (IsMonthStart() && IsFri()){
//alert('月初和周五');
var str = "亲,月初和周末撞车了哈,绩效监控的周记录和上月小结写了没?别怪我没提醒你呦!";
showmsg(str);
}else if (IsMonthStart()){
//alert('月初');
var str = "亲,月初了,绩效监控的上月小结写了没?别怪我没提醒你呦!";
showmsg(str);
}else if (IsMonthEnd()){
//alert('月末');
var str = "亲,月末了,绩效监控的下月计划写了没?别怪我没提醒你呦!";
showmsg(str);
}else if (IsFri()){
//alert('周五');
var str = "亲,周末了,绩效监控的周记录写了没?别怪我没提醒你呦!";
showmsg(str);
}
$(document).ready(function () {
setTimeout(function () {
jxtx_display();
}, 1000);
$("#close").click(function () {
$("#jxtxslide").slideUp("slow"); $("#reshow").show();
})
$("#reshow").click(function () {
jxtx_display();
})
})