<script type="text/JavaScript">
window.onerror = function(){return true;}
var songDesktop = {
winWidth : 0,
winHeight : 0,
TaskbarHeight : 40,
StartListHeight : 530,
StartListWidth : 220,
ShowIcon : <?php echo $Icon;?>,
iconDivWidth : <?php echo $Shortcut['Width'];?>,
iconDivHeight : <?php echo $Shortcut['Height'];?>,
winSize : function(){
if (window.innerWidth){
this.winWidth = window.innerWidth;
}else if ((document.body) && (document.body.clientWidth)){
this.winWidth = document.body.clientWidth;
}
if (window.innerHeight){
this.winHeight = window.innerHeight;
}else if ((document.body) && (document.body.clientHeight)){
this.winHeight = document.body.clientHeight;
}
if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth){
this.winWidth = document.documentElement.clientWidth;
this.winHeight = document.documentElement.clientHeight;
}
},
aNUT : (navigator.userAgent.toLowerCase()),
IeTrueBody : function(){
return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;
},
GetScrollTop : function(){
return ($.browser.msie) ? this.IeTrueBody().scrollTop : window.pageYOffset;
},
floating : function(id,tpe){
var winsize = this.winSize();
var Top = (tpe == 'Task') ? ( this.GetScrollTop() + this.winHeight - this.TaskbarHeight) : (this.GetScrollTop() + this.winHeight - this.StartListHeight - this.TaskbarHeight + 8);
document.getElementById(id).style.top = Top + "px";
},
inShow : function(id){
var idDisplay = $('#' + id).css("display");
if(idDisplay == 'none'){
$('#' + id).show(250);
} else {
$('#' + id).hide(250);
}
},
songajax : function(id){
$("#StartList").fadeOut("slow");
return songajax.htmlExpand(id,{objectType:'iframe'});
},
inco : function(){
this.winSize();
var dHeight = this.iconDivHeight;
var table = '<table><tr>';
table += '<td>';
$.each(this.ShowIcon,function(i,n){
table += '<div class="icon">';
table += '<ol class="img"><a href="' + n[2] + '" onclick="return songajax.htmlExpand(this,{objectType:\'iframe\'});"><img src="' + n[1] + '" width="40" height="40" /></a></ol>';
table += '<ol class="text">' + n[3] + '</ol>';
table += '</div>';
dHeight = dHeight + songDesktop.iconDivHeight;
if(dHeight >= (songDesktop.winHeight - songDesktop.TaskbarHeight + 10)){
table += '</td><td>';
dHeight = songDesktop.iconDivHeight;
}
});
table += '</td>';
table += '</tr></table>';
return table;
},
startmarquee : function(lh,speed,delay,id){
var t;
var p=false;
var o=document.getElementById(id);
o.innerHTML+=o.innerHTML;
o.onmouseover=function(){p=true}
o.onmouseout=function(){p=false}
o.scrollTop = 0;
function start(){
t=setInterval(scrolling,speed);
if(!p) o.scrollTop += 2;
}
function scrolling(){
if(o.scrollTop%lh!=0){
o.scrollTop += 2;
if(o.scrollTop>=o.scrollHeight/2) o.scrollTop = 0;
}else{
clearInterval(t);
setTimeout(start,delay);
}
}
setTimeout(start,delay);
},
environment : function(){
var Environments = "";
if ($.browser.msie && $.browser.version < 7) Environments = '你的浏览器版本太低,建议升级至 IE 7.0或以上版本获得最佳展示效果。<br>';
var dir_name = document.location.pathname.substring(0,document.location.pathname.lastIndexOf("/"));
dir_name = dir_name.substring(dir_name.lastIndexOf("/")+1);
if(dir_name == 'admin') Environments += '安全提示:您采用默认后台目录名,请更改admin文件夹名称。<br>';
return Environments;
}
}
var winsize = new songDesktop.winSize();
songajax.picsDir = './songajax/';
songajax.lang.closeTitle = '关闭';
songajax.allowMultipleInstances = true;
songajax.expandDuration = 300;
songajax.restoreDuration = 300;
songajax.marginLeft = 100;
songajax.marginTop = 10;
songajax.marginBottom = 40;
if ($.browser.msie && $.browser.version < 8){
songajax.marginRight = 30;
} else {
songajax.marginRight = 10;
}
songajax.width = winsize.winWidth - (songajax.marginLeft + songajax.marginRight);
songajax.height = winsize.winHeight - (songajax.marginTop + songajax.marginBottom);
songajax.outlineType = 'songajax';
songajax.wrapperClassName = 'admin-style';
$(window).scroll(function(){
songDesktop.floating('StatusBar','Task');
songDesktop.floating('StartList','Start');
});
$(window).resize(function(){
songDesktop.floating('StatusBar','Task');
songDesktop.floating('StartList','Start');
$("#Desktop").html(songDesktop.inco());
});
$(document).ready(function(){
$("#Desktop").css({width:"100%",height:winsize.winHeight});
$("#Desktop").mousedown(function(){
$("#StartList").fadeOut("slow");
});
$("#StartList").css({width:songDesktop.StartListWidth + 'px',height:songDesktop.StartListHeight + 'px'});
$("#Desktop").html(songDesktop.inco());
$("dd:not(:first)").hide();
$("dt").click(function(){
$("dd").slideUp("fast");
$(this).next().slideDown("fast");
return false;
});
$.getScript(OfficialAnnoURL,function(){
if(typeof(OfficialAnno) == 'undefined') {
$("#oRight").html(songDesktop.environment());
} else {
$("#oRight").html(songDesktop.environment()+OfficialAnno);
}
var xTime = ($.browser.msie) ? 3 : 20;
songDesktop.startmarquee(30,xTime,5000,'oRight');
});
<?php if($_SESSION['Logins'] <= 2){?>
$("#StartList").css("display","block");
<?php }?>
});
</script>
window.onerror = function(){return true;}
var songDesktop = {
winWidth : 0,
winHeight : 0,
TaskbarHeight : 40,
StartListHeight : 530,
StartListWidth : 220,
ShowIcon : <?php echo $Icon;?>,
iconDivWidth : <?php echo $Shortcut['Width'];?>,
iconDivHeight : <?php echo $Shortcut['Height'];?>,
winSize : function(){
if (window.innerWidth){
this.winWidth = window.innerWidth;
}else if ((document.body) && (document.body.clientWidth)){
this.winWidth = document.body.clientWidth;
}
if (window.innerHeight){
this.winHeight = window.innerHeight;
}else if ((document.body) && (document.body.clientHeight)){
this.winHeight = document.body.clientHeight;
}
if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth){
this.winWidth = document.documentElement.clientWidth;
this.winHeight = document.documentElement.clientHeight;
}
},
aNUT : (navigator.userAgent.toLowerCase()),
IeTrueBody : function(){
return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;
},
GetScrollTop : function(){
return ($.browser.msie) ? this.IeTrueBody().scrollTop : window.pageYOffset;
},
floating : function(id,tpe){
var winsize = this.winSize();
var Top = (tpe == 'Task') ? ( this.GetScrollTop() + this.winHeight - this.TaskbarHeight) : (this.GetScrollTop() + this.winHeight - this.StartListHeight - this.TaskbarHeight + 8);
document.getElementById(id).style.top = Top + "px";
},
inShow : function(id){
var idDisplay = $('#' + id).css("display");
if(idDisplay == 'none'){
$('#' + id).show(250);
} else {
$('#' + id).hide(250);
}
},
songajax : function(id){
$("#StartList").fadeOut("slow");
return songajax.htmlExpand(id,{objectType:'iframe'});
},
inco : function(){
this.winSize();
var dHeight = this.iconDivHeight;
var table = '<table><tr>';
table += '<td>';
$.each(this.ShowIcon,function(i,n){
table += '<div class="icon">';
table += '<ol class="img"><a href="' + n[2] + '" onclick="return songajax.htmlExpand(this,{objectType:\'iframe\'});"><img src="' + n[1] + '" width="40" height="40" /></a></ol>';
table += '<ol class="text">' + n[3] + '</ol>';
table += '</div>';
dHeight = dHeight + songDesktop.iconDivHeight;
if(dHeight >= (songDesktop.winHeight - songDesktop.TaskbarHeight + 10)){
table += '</td><td>';
dHeight = songDesktop.iconDivHeight;
}
});
table += '</td>';
table += '</tr></table>';
return table;
},
startmarquee : function(lh,speed,delay,id){
var t;
var p=false;
var o=document.getElementById(id);
o.innerHTML+=o.innerHTML;
o.onmouseover=function(){p=true}
o.onmouseout=function(){p=false}
o.scrollTop = 0;
function start(){
t=setInterval(scrolling,speed);
if(!p) o.scrollTop += 2;
}
function scrolling(){
if(o.scrollTop%lh!=0){
o.scrollTop += 2;
if(o.scrollTop>=o.scrollHeight/2) o.scrollTop = 0;
}else{
clearInterval(t);
setTimeout(start,delay);
}
}
setTimeout(start,delay);
},
environment : function(){
var Environments = "";
if ($.browser.msie && $.browser.version < 7) Environments = '你的浏览器版本太低,建议升级至 IE 7.0或以上版本获得最佳展示效果。<br>';
var dir_name = document.location.pathname.substring(0,document.location.pathname.lastIndexOf("/"));
dir_name = dir_name.substring(dir_name.lastIndexOf("/")+1);
if(dir_name == 'admin') Environments += '安全提示:您采用默认后台目录名,请更改admin文件夹名称。<br>';
return Environments;
}
}
var winsize = new songDesktop.winSize();
songajax.picsDir = './songajax/';
songajax.lang.closeTitle = '关闭';
songajax.allowMultipleInstances = true;
songajax.expandDuration = 300;
songajax.restoreDuration = 300;
songajax.marginLeft = 100;
songajax.marginTop = 10;
songajax.marginBottom = 40;
if ($.browser.msie && $.browser.version < 8){
songajax.marginRight = 30;
} else {
songajax.marginRight = 10;
}
songajax.width = winsize.winWidth - (songajax.marginLeft + songajax.marginRight);
songajax.height = winsize.winHeight - (songajax.marginTop + songajax.marginBottom);
songajax.outlineType = 'songajax';
songajax.wrapperClassName = 'admin-style';
$(window).scroll(function(){
songDesktop.floating('StatusBar','Task');
songDesktop.floating('StartList','Start');
});
$(window).resize(function(){
songDesktop.floating('StatusBar','Task');
songDesktop.floating('StartList','Start');
$("#Desktop").html(songDesktop.inco());
});
$(document).ready(function(){
$("#Desktop").css({width:"100%",height:winsize.winHeight});
$("#Desktop").mousedown(function(){
$("#StartList").fadeOut("slow");
});
$("#StartList").css({width:songDesktop.StartListWidth + 'px',height:songDesktop.StartListHeight + 'px'});
$("#Desktop").html(songDesktop.inco());
$("dd:not(:first)").hide();
$("dt").click(function(){
$("dd").slideUp("fast");
$(this).next().slideDown("fast");
return false;
});
$.getScript(OfficialAnnoURL,function(){
if(typeof(OfficialAnno) == 'undefined') {
$("#oRight").html(songDesktop.environment());
} else {
$("#oRight").html(songDesktop.environment()+OfficialAnno);
}
var xTime = ($.browser.msie) ? 3 : 20;
songDesktop.startmarquee(30,xTime,5000,'oRight');
});
<?php if($_SESSION['Logins'] <= 2){?>
$("#StartList").css("display","block");
<?php }?>
});
</script>
http://docs.jquery.com/Main_Page
function $(id) {return document.getElementById(id);}若$被别的js文件用了,可以用 jQuery来代替比如 jQuery('#id')