C# 项目开发全程实录 第9个项目:在线考试系统 admin 》left.htm 显示 和隐藏切换方法疑问
发表在C#图书答疑
2014-09-10
是否精华
是
否
版块置顶:
是
否
请老师帮忙讲一下这个切换的原理是什么呢 谢谢
我只知道原来hide()点击则show(),原理show()点击则hide(),
疑问:
1.方便讲一下每个语句的用途吗,大致能看懂,却不知道具体有什么用(我知道obj是传来的二级菜单div,maxg是div的高度,obj2是一级菜单td)
function show(obj,maxg,obj2)
{
if(obj.style.pixelHeight<maxg)
{
obj.style.pixelHeight+=maxg/10;
obj.filters.alpha.opacity+=20;
obj2.background="Img/back_11.gif";
if(obj.style.pixelHeight==maxg/10)
obj.style.display='block';
myObj=obj;
mymaxg=maxg;
myObj2=obj2;
setTimeout('show(myObj,mymaxg,myObj2)','5');
}
}
function hide(obj,maxg,obj2)
{
if(obj.style.pixelHeight>0)
{
if(obj.style.pixelHeight==maxg/5)
obj.style.display='none';
obj.style.pixelHeight-=maxg/5;
obj.filters.alpha.opacity-=10;
obj2.background="Img/back_08.gif";
myObj=obj;
mymaxg=maxg
myObj2=obj2;
setTimeout('hide(myObj,mymaxg,myObj2)','5');
}
else if(whichContinue)
whichContinue.click();
}
function chang(obj,maxg,obj2)
{
if(obj.style.pixelHeight)
{
hide(obj,maxg,obj2);
nopen='';
whichcontinue='';
}
else if(nopen)
{
whichContinue=obj2;
nopen.click();
}
else
{
show(obj,maxg,obj2);
nopen=obj2;
whichContinue='';
}
}
我只知道原来hide()点击则show(),原理show()点击则hide(),
疑问:
1.方便讲一下每个语句的用途吗,大致能看懂,却不知道具体有什么用(我知道obj是传来的二级菜单div,maxg是div的高度,obj2是一级菜单td)
function show(obj,maxg,obj2)
{
if(obj.style.pixelHeight<maxg)
{
obj.style.pixelHeight+=maxg/10;
obj.filters.alpha.opacity+=20;
obj2.background="Img/back_11.gif";
if(obj.style.pixelHeight==maxg/10)
obj.style.display='block';
myObj=obj;
mymaxg=maxg;
myObj2=obj2;
setTimeout('show(myObj,mymaxg,myObj2)','5');
}
}
function hide(obj,maxg,obj2)
{
if(obj.style.pixelHeight>0)
{
if(obj.style.pixelHeight==maxg/5)
obj.style.display='none';
obj.style.pixelHeight-=maxg/5;
obj.filters.alpha.opacity-=10;
obj2.background="Img/back_08.gif";
myObj=obj;
mymaxg=maxg
myObj2=obj2;
setTimeout('hide(myObj,mymaxg,myObj2)','5');
}
else if(whichContinue)
whichContinue.click();
}
function chang(obj,maxg,obj2)
{
if(obj.style.pixelHeight)
{
hide(obj,maxg,obj2);
nopen='';
whichcontinue='';
}
else if(nopen)
{
whichContinue=obj2;
nopen.click();
}
else
{
show(obj,maxg,obj2);
nopen=obj2;
whichContinue='';
}
}