网站制作学习网JS脚本→正文:js滑门
字体:

js滑门

JS脚本 2008/4/11 10:32:03  点击:不统计

js滑门,js滑门效果,js滑动,js选项卡



js滑门特效

将下列代码保存为html运行即可

<style type="text/css">

.titleStyle{

background-color:#AAC9D9;

color:#000066;

border-top:1px solid #FFFFFF;

font-size:12px;

cursor:hand;

font-weight: bold;

text-align: left;

padding-left: 20px;

}

.contentStyle{

background-color:#DDEAF0;

color:blue;

font-size:12px;

text-align: left;

padding-left: 20px;

line-height: 200%;

}

</style>



<table><tr><td><a href="#" onclick="changeItem(0);">1</a> <a href="#" onclick="changeItem(1);">2</a></td></tr></table>

<script language="JavaScript">

<!--

var layerTop=0;

var layerLeft=0;

var layerWidth=180;

var titleHeight=28;

var contentHeight=300;

var stepNo=10;



var itemNo=0;runtimes=0;

document.write('<span id=itemsLayer style="position:relative;overflow:hidden;border:1px solid #AAC9D9;left:'+layerLeft+';top:'+layerTop+';width:'+layerWidth+';">');



function addItem(itemTitle,itemContent)

{

itemHTML='<div id=item'+itemNo+' itemIndex='+itemNo+' style="position:relative;left:0;top:'+(-contentHeight*itemNo)+';width:'+layerWidth+';"><table width=100% cellspacing="0" cellpadding="0">'+

'<tr><td height='+titleHeight+' onclick=changeItem('+itemNo+') class="titleStyle" align=center>'+itemTitle+'</td></tr>'+

'<tr><td height='+contentHeight+' class="contentStyle">'+itemContent+'</td></tr></table></div>';

document.write(itemHTML);

itemNo++;

}



addItem('桌面环境管理外包','<a href="http://www.forasp.cn">2005年目录</a> <BR><a href="http://www.forasp.cn/">2006年目录</a> <BR>');

addItem('IT外包服务','<a href="http://www.forasp.cn/">桌面环境管理外包</a> <BR><a href="http://www.forasp.cn/">系统维护外包</a> <BR><a href="http://www.forasp.cn/catalog_2006.html#category292905">基础架构管理外包</a> <BR><a href="http://www.forasp.cn/">图文设计外包</a><BR><a href="http://www.forasp.cn/">网站维护外包</a><BR><a href="http://www.forasp.cn">数据恢复服务</a><BR><a href="http://www.forasp.cn/">IT小时工</a><BR><a href="http://www.forasp.cn/">项目外包服务</a><BR><a href="http://www.forasp.cn/">关于IT外包</a><BR><a href="http://www.forasp.cn/">IT救援</a><BR><a href="http://www.forasp.cn/">');



addItem('软件工程外包','<a href="http://www.forasp.cn/">[博客技巧]展开式菜单</a> <BR><a href="http://www.forasp.cn/">[照片]第一集</a> <BR><a href="http://www.forasp.cn">[单片机学习]AT89S51教程</a> <BR>');

addItem('网站建设与推广','<a href="">单片机论坛 </a> <BR><a href="http://cafe.hanbbs.com/">人在昌平</a> <BR><a href="http://disk.zzlygo.com/myspace.aspx?username=lizhiyuan">我的网络硬盘</a> <BR>');

addItem('服务与方案','<a href="http://www.forasp.cn">征集中...</a> <BR>');

addItem('系统集成','<a href="http://www.forasp.cn">征集中...</a> <BR>');

addItem('网络安全培训','<a href="http://www.forasp.cn">征集中...</a> <BR>');

addItem('客户服务中心','<a href="http://www.forasp.cn">征集中...</a> <BR>');



document.write('</span>')

document.all.itemsLayer.style.height=itemNo*titleHeight+contentHeight;



toItemIndex=itemNo-1;onItemIndex=itemNo-1;



function changeItem(clickItemIndex)

{

toItemIndex=clickItemIndex;

if(toItemIndex-onItemIndex>0) moveUp(); else moveDown();

runtimes++;

if(runtimes>=stepNo){

onItemIndex=toItemIndex;

runtimes=0;}

else

setTimeout("changeItem(toItemIndex)",10);

}



function moveUp()

{

for(i=onItemIndex+1;i<=toItemIndex;i++)

eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)-contentHeight/stepNo;');

}



function moveDown()

{

for(i=onItemIndex;i>toItemIndex;i--)

eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)+contentHeight/stepNo;');

}

var clickid

changeItem(0);

//-->

</script>

·上一篇:检测IP >>    ·下一篇:js添加table行 >>
推荐文章
最新文章