请各位看看这段php代码中的javascript中的$是什么意思

xynn2008 软件研发工程师  2010-07-31 10:35:45
<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>
...全文
64 点赞 收藏 7
写回复
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
xynn2008 2010-07-31
长见识了,谢谢各位
回复
kyzy_yy_pm 2010-07-31
上面的和下面的一个样

<div id="div">div</div>
<script>
var abc = document.getElementById;
alert(abc("div").innerHTML);
</script>
回复
kyzy_yy_pm 2010-07-31
<div id="div">div</div>
<script>
var $ = document.getElementById;
alert($("div").innerHTML);
</script>
回复
kyzy_yy_pm 2010-07-31
$就像a,b,c一个样,将其定义成了一个对象,对象里有很多的方法
回复
xynn2008 2010-07-31
谢谢指点
回复
CunningBoy 2010-07-31
JavaScript中的$是JQuery的语法,例如$("dd")表示HTML页面中的dd标签
具体查看
http://docs.jquery.com/Main_Page
回复
发动态
发帖子
基础编程
创建于2007-09-28

2.1w+

社区成员

从PHP安装配置,PHP入门,PHP基础到PHP应用
申请成为版主
社区公告
暂无公告