网上抓的一个特效


Posted in Javascript onMay 11, 2007

特效在窗口左边,可否改在窗口右边???
效果页面代码:
<SCRIPT language=javascript>
                ad_p1_sp15_n6 = '';
                ad_p1_sp15_n7 = '';
                ad_p1_sp15_n8 = '';
            </SCRIPT>

<TABLE cellSpacing=0 cellPadding=0 width=750 align=center border=0>
  <TBODY>
  <TR>
    <TD>
      <DIV align=center>
      <SCRIPT language=javascript>document.write(ad_p1_sp15_n6);</SCRIPT>
      </DIV></TD></TR></TBODY></TABLE></DIV>
<SCRIPT language=JavaScript>
<!--
    document.getElementById("divTopAd").innerHTML = document.getElementById("divTopAdTmp").innerHTML;
    document.getElementById("divTopAdTmp").innerHTML = "";
//-->
</SCRIPT>

<DIV id=divBottomAdTmp style="DISPLAY: none">
<SCRIPT language=javascript>document.write(ad_p1_sp15_n7);</SCRIPT>
<BR>
<SCRIPT language=javascript>document.write(ad_p1_sp15_n8);</SCRIPT>
</DIV>
<SCRIPT language=JavaScript>
<!--
    document.getElementById("divBottomAd").innerHTML = document.getElementById("divBottomAdTmp").innerHTML;
    document.getElementById("divBottomAdTmp").innerHTML = "";
//-->
</SCRIPT>

<SCRIPT language=JavaScript 
src="menu.js"></SCRIPT>
menu.js 文件代码:

[Copy to clipboard] [ - ]CODE:
//----begin-----共用函数-----
function buildBar() 
{
    if(barText.indexOf('<IMG')>-1) 
    {
        tempBar=barText;
    }
    else
    {
        for (b=0;b<barText.length;b++) 
        {
            tempBar+=barText.charAt(b)+"<BR>";
        }
    }
    document.write('<td align="center" rowspan="100" width="'+barWidth+'" bgcolor="'+barBGColor+'" valign="'+barVAlign+'"><a href="http://www.netsh.com" target="_blank" alt="乐趣首页"><img src="http://tpic.netsh.com/eden/img/office.gif" border="0"></a></TD>')
}
//----end-----共用函数-----

//----begin-----IE浏览器部分-----

function moveIEOut() 
{
    if (ssm.pixelLeft<0) 
    {
        clearTimeout(moving);moving = setTimeout('moveIEOut()', slideSpeed);slideIEMenu(10)
    }
    else
    {
        clearTimeout(moving);moving=setTimeout('null',1)
    }
}

function moveIEBack() 
{
    clearTimeout(moving);moving = setTimeout('moveIEBack1()', waitTime)
}
function moveIEBack1() 
{
    if (ssm.pixelLeft>(-menuWidth)) 
    {
        clearTimeout(moving);moving = setTimeout('moveIEBack1()', slideSpeed);slideIEMenu(-10)
    }
    else 
    {
        clearTimeout(moving);moving=setTimeout('null',1)
    }
}

function slideIEMenu(num)
{
    ssm.pixelLeft += num;
}

function makeIEStatic() 
{
    winY = document.body.scrollTop;
    if (winY!=lastY&&winY>YOffset-staticYOffset) 
    {
        smooth = .2 * (winY - lastY - YOffset + staticYOffset);
    }
    else if (YOffset-staticYOffset+lastY>YOffset-staticYOffset) 
    {
        smooth = .2 * (winY - lastY - (YOffset-(YOffset-winY)));
    }
    else 
    {
        smooth=0;
    }
    if(smooth > 0) 
    {
        smooth = Math.ceil(smooth);
    }
    else
    {
        smooth = Math.floor(smooth);
    }
    bssm.pixelTop+=smooth;
    lastY = lastY+smooth;
    setTimeout('makeIEStatic()', 1)
}

function initIESlide() 
{
    ssm=document.all("thessm").style;
    bssm=document.all("basessm").style;
    bssm.clip="rect(0 "+thessm.offsetWidth+" "+thessm.offsetHeight+" 0)";
    bssm.visibility = "visible";
    if (menuIsStatic=="yes") 
    {
        makeIEStatic();
    }
}

function buildIEMenu()
{
    document.write('<DIV style="line-height: 1.2;" ID="basessm" style="visibility:hidden;Position : Absolute ;Left : '+XOffset+' ;Top : '+YOffset+' ;Z-Index : 20;width:'+(menuWidth+barWidth+10)+'"><DIV style="line-height: 1.2;" ID="thessm" style="Position : Absolute ;Left : '+(-menuWidth)+' ;Top : 0 ;Z-Index : 20;" onmouseover="moveIEOut()" onmouseout="moveIEBack()">')
    document.write('<table border="0" cellpadding="0" cellspacing="1" width="'+(menuWidth+barWidth+2)+'" bgcolor="'+menuBGColor+'">');
    for(i=0;i<ssmItems.length;i++) 
    {
        if(!ssmItems[i][3])
        {
            ssmItems[i][3]=menuCols;
            ssmItems[i][5]=menuWidth-1;
        }
        else if(ssmItems[i][3]!=menuCols)
        {
            ssmItems[i][5]=Math.round(menuWidth*(ssmItems[i][3]/menuCols)-1);
        }
        if(ssmItems[i-1]&&ssmItems[i-1][4]!="no")
        {
            document.write('<TR>');
        }
        if(!ssmItems[i][1])
        {
            document.write('<td style="line-height: 1.2;" bgcolor="'+hdrBGColor+'" ALIGN="'+hdrAlign+'" VALIGN="'+hdrVAlign+'" WIDTH="'+ssmItems[i][5]+'" COLSPAN="'+ssmItems[i][3]+'"> <font face="'+hdrFontFamily+'" Size="'+hdrFontSize+'" COLOR="'+hdrFontColor+'"><b>'+ssmItems[i][0]+'</b></font></td>')
        }
        else 
        {
            if(!ssmItems[i][2])
            {
                ssmItems[i][2]=linkTarget;
            }
            document.write('<TD style="line-height: 1.2;" BGCOLOR="'+linkBGColor+'" onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" WIDTH="'+ssmItems[i][5]+'" COLSPAN="'+ssmItems[i][3]+'"><ILAYER><LAYER onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" WIDTH="100%" ALIGN="'+linkAlign+'"><DIV style="line-height: 1.2;"  ALIGN="'+linkAlign+'"><FONT face="'+linkFontFamily+'" Size="'+linkFontSize+'"> <A HREF="'+ssmItems[i][1]+'" target="'+ssmItems[i][2]+'" style="font-size:12px">'+ssmItems[i][0]+'</DIV></LAYER></ILAYER></TD>')
        }
        if(ssmItems[i][4]!="no"&&barBuilt==0)
        {
            buildBar();
            barBuilt=1;
        }
        if(ssmItems[i][4]!="no")
        {
            document.write('</TR>')
        }
    }
    document.write('</table>')
    document.write('</DIV></DIV>')
    theleft=-menuWidth;lastY=0;setTimeout('initIESlide();', 1)
}
//----end-----IE浏览器部分-----

//----begin-----NS部分-----
function moveNSOut() 
{
    if (parseInt(ssm.left)<0) 
    {
        clearTimeout(moving);moving = setTimeout('moveNSOut()', slideSpeed);slideNSMenu(10)
    }
    else
    {
        clearTimeout(moving);moving=setTimeout('null',1)
    }
}

function moveNSBack() 
{
    clearTimeout(moving);moving = setTimeout('moveNSBack1()', waitTime)
}

function moveNSBack1() 
{
    if (parseInt(ssm.left)>(-menuWidth)) 
    {
        clearTimeout(moving);moving = setTimeout('moveNSBack1()', slideSpeed);slideNSMenu(-10)
    }
    else 
    {
        clearTimeout(moving);moving=setTimeout('null',1)
    }
}

function slideNSMenu(num)
{
    ssm.left = parseInt(ssm.left)+num;
    bssm.clip.right+=num;bssm2.clip.right+=num;
}

function makeNSStatic() 
{
    winY = window.pageYOffset;
    if (winY!=lastY&&winY>YOffset-staticYOffset) 
    {
        smooth = .2 * (winY - lastY - YOffset + staticYOffset);
    }
    else if (YOffset-staticYOffset+lastY>YOffset-staticYOffset) 
    {
        smooth = .2 * (winY - lastY - (YOffset-(YOffset-winY)));
    }
    else 
    {
        smooth=0;
    }
    if(smooth > 0) 
    {
        smooth = Math.ceil(smooth);
    }
    else
    {
        smooth = Math.floor(smooth);
    }
    bssm.top=parseInt(bssm.top)+smooth
    lastY = lastY+smooth;
    setTimeout('makeNSStatic()', 1)
}

function initNSSlide() 
{
    bssm=document.layers["basessm1"];
    bssm2=bssm.document.layers["basessm2"];ssm=bssm2.document.layers["thessm"];
    bssm2.clip.left=0;ssm.visibility = "show";
    if (menuIsStatic=="yes") 
    {
        makeNSStatic();
    }
}

function buildNSMenu()
{
    document.write('<LAYER name="basessm1" top="'+YOffset+'" LEFT='+XOffset+' visibility="show"><ILAYER name="basessm2"><LAYER visibility="hide" name="thessm" bgcolor="'+menuBGColor+'" left="'+(-menuWidth)+'" onmouseover="moveNSOut()" onmouseout="moveNSBack()">')
    document.write('<table border="0" cellpadding="0" cellspacing="1" width="'+(menuWidth+barWidth+2)+'" bgcolor="'+menuBGColor+'">');
    for(i=0;i<ssmItems.length;i++) 
    {
        if(!ssmItems[i][3])
        {
            ssmItems[i][3]=menuCols;
            ssmItems[i][5]=menuWidth-1;
        }
        else if(ssmItems[i][3]!=menuCols)
        {
            ssmItems[i][5]=Math.round(menuWidth*(ssmItems[i][3]/menuCols)-1);
        }
        if(ssmItems[i-1]&&ssmItems[i-1][4]!="no")
        {
            document.write('<TR>');
        }
        if(!ssmItems[i][1])
        {
            document.write('<td style="line-height: 1.2;" bgcolor="'+hdrBGColor+'" ALIGN="'+hdrAlign+'" VALIGN="'+hdrVAlign+'" WIDTH="'+ssmItems[i][5]+'" COLSPAN="'+ssmItems[i][3]+'"> <font face="'+hdrFontFamily+'" Size="'+hdrFontSize+'" COLOR="'+hdrFontColor+'"><b>'+ssmItems[i][0]+'</b></font></td>')
        }
        else 
        {
            if(!ssmItems[i][2])
            {
                ssmItems[i][2]=linkTarget;
            }
            document.write('<TD style="line-height: 1.2;" BGCOLOR="'+linkBGColor+'" onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" WIDTH="'+ssmItems[i][5]+'" COLSPAN="'+ssmItems[i][3]+'"><ILAYER><LAYER onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" WIDTH="100%" ALIGN="'+linkAlign+'"><DIV style="line-height: 1.2;"  ALIGN="'+linkAlign+'"><FONT face="'+linkFontFamily+'" Size="'+linkFontSize+'"> <A HREF="'+ssmItems[i][1]+'" target="'+ssmItems[i][2]+'" style="font-size:12px">'+ssmItems[i][0]+'</DIV></LAYER></ILAYER></TD>')
        }
        if(ssmItems[i][4]!="no"&&barBuilt==0)
        {
            buildBar();
            barBuilt=1;
        }
        if(ssmItems[i][4]!="no")
        {
            document.write('</TR>')
        }
    }
    document.write('</table>')
    document.write('</LAYER></ILAYER></LAYER>')
    theleft=-menuWidth;lastY=0;setTimeout('initNSSlide();', 1)
}
//-----end------NS部分-----

//-----begin------NS6部分-----
function moveNS6Out() 
{
    if (parseInt(ssm.left)<0) 
    {
        clearTimeout(moving);moving = setTimeout('moveNS6Out()', slideSpeed);slideNS6Menu(10)
    }
    else
    {
        clearTimeout(moving);moving=setTimeout('null',1)
    }
}
function moveNS6Back() 
{
    clearTimeout(moving);moving = setTimeout('moveNS6Back1()', waitTime)
}
function moveNS6Back1() 
{
    if (parseInt(ssm.left)>(-menuWidth)) 
    {
        clearTimeout(moving);moving = setTimeout('moveNS6Back1()', slideSpeed);slideNS6Menu(-10)
    }
    else 
    {
        clearTimeout(moving);moving=setTimeout('null',1)
    }
}

function slideNS6Menu(num)
{
    ssm.left = parseInt(ssm.left)+num;
}

function makeNS6Static() 
{
    winY = window.pageYOffset;
    if (winY!=lastY&&winY>YOffset-staticYOffset) 
    {
        smooth = .2 * (winY - lastY - YOffset + staticYOffset);
    }
    else if (YOffset-staticYOffset+lastY>YOffset-staticYOffset) 
    {
        smooth = .2 * (winY - lastY - (YOffset-(YOffset-winY)));
    }
    else 
    {
        smooth=0;
    }
    if(smooth > 0) 
    {
        smooth = Math.ceil(smooth);
    }
    else
    {
        smooth = Math.floor(smooth);
    }
    bssm.top=parseInt(bssm.top)+smooth
    lastY = lastY+smooth;
    setTimeout('makeNS6Static()', 1)
}

function initNS6Slide() 
{
    ssm=document.getElementById("thessm").style;bssm=document.getElementById("basessm").style;
    bssm.clip="rect(0 "+document.getElementById("thessm").offsetWidth+" "+document.getElementById("thessm").offsetHeight+" 0)";
    ssm.visibility="visible";
    if (menuIsStatic=="yes") 
    {
        makeNS6Static();
    }
}

function buildNS6Menu() 
{
    document.write('<DIV style="line-height: 1.2;" ID="basessm" style="visibility:hidden;Position : Absolute ;Left : '+XOffset+' ;Top : '+YOffset+' ;Z-Index : 20;width:'+(menuWidth+barWidth+10)+'"><DIV style="line-height: 1.2;" ID="thessm" style="Position : Absolute ;Left : '+(-menuWidth)+' ;Top : 0 ;Z-Index : 20;" onmouseover="moveNS6Out()" onmouseout="moveNS6Back()">')
    document.write('<table border="0" cellpadding="0" cellspacing="0" width="'+(menuWidth+barWidth+2)+'" bgcolor="'+menuBGColor+'"><TR><TD>')
    document.write('<table border="0" cellpadding="0" cellspacing="1" width="'+(menuWidth+barWidth+2)+'" bgcolor="'+menuBGColor+'">');
    for(i=0;i<ssmItems.length;i++) 
    {
        if(!ssmItems[i][3])
        {
            ssmItems[i][3]=menuCols;
            ssmItems[i][5]=menuWidth-1;
        }
        else if(ssmItems[i][3]!=menuCols)
        {
            ssmItems[i][5]=Math.round(menuWidth*(ssmItems[i][3]/menuCols)-1);
        }
        if(ssmItems[i-1]&&ssmItems[i-1][4]!="no")
        {
            document.write('<TR>');
        }
        if(!ssmItems[i][1])
        {
            document.write('<td style="line-height: 1.2;" bgcolor="'+hdrBGColor+'" ALIGN="'+hdrAlign+'" VALIGN="'+hdrVAlign+'" WIDTH="'+ssmItems[i][5]+'" COLSPAN="'+ssmItems[i][3]+'"> <font face="'+hdrFontFamily+'" Size="'+hdrFontSize+'" COLOR="'+hdrFontColor+'"><b>'+ssmItems[i][0]+'</b></font></td>')
        }
        else 
        {
            if(!ssmItems[i][2])
            {
                ssmItems[i][2]=linkTarget;
            }
            document.write('<TD style="line-height: 1.2;" BGCOLOR="'+linkBGColor+'" onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" WIDTH="'+ssmItems[i][5]+'" COLSPAN="'+ssmItems[i][3]+'"><ILAYER><LAYER onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" WIDTH="100%" ALIGN="'+linkAlign+'"><DIV style="line-height: 1.2;"  ALIGN="'+linkAlign+'"><FONT face="'+linkFontFamily+'" Size="'+linkFontSize+'"> <A HREF="'+ssmItems[i][1]+'" target="'+ssmItems[i][2]+'" style="font-size:12px">'+ssmItems[i][0]+'</DIV></LAYER></ILAYER></TD>')
        }
        if(ssmItems[i][4]!="no"&&barBuilt==0)
        {
            buildBar();
            barBuilt=1;
        }
        if(ssmItems[i][4]!="no")
        {
            document.write('</TR>')
        }
    }
    document.write('</table>')
    document.write('</TD></TR></TABLE>')
    document.write('</DIV></DIV>')
    theleft=-menuWidth;lastY=0;setTimeout('initNS6Slide();', 1)
}
//-----end------NS6部分-----

NS6 = (document.getElementById&&!document.all)
IE = (document.all)
NS = (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4")
tempBar='';barBuilt=0;ssmItems=new Array();
moving=setTimeout('null',1)

YOffset=150;
XOffset=0;
staticYOffset=30;
slideSpeed=20
waitTime=50;
menuBGColor="";
menuIsStatic="yes";
menuWidth=100;
menuCols=2;
hdrFontFamily="verdana";
hdrFontSize="2";
hdrFontColor="#000000";
hdrBGColor="#ffffff";
hdrAlign="left";
hdrVAlign="center";
hdrHeight="15";
linkFontFamily="Verdana";
linkFontSize="2";
linkBGColor="white";
linkOverBGColor="#FFFF99";
linkTarget="_top";
linkAlign="Left";
barBGColor="";
barFontFamily="Verdana";
barFontSize="2";
barFontColor="#ff3333";
barVAlign="center";
barWidth=20;
barText="※乐趣 个人事务所※"; 

ssmItems[0]=["我要注册", "/eden/ctl_eden_login.php?ctlObj=login_protocol", "_blank"]
ssmItems[1]=["我的首页", "/eden/ctl_eden.php", "_blank"]
ssmItems[2]=["我的收藏夹", "/eden/ctl_eden.php?ctlOprType=get&ctlObj=favorites", "_blank"]
ssmItems[3]=["我的好友", "/eden/ctl_eden.php?ctlOprType=get&ctlObj=friends", "_blank"]
ssmItems[4]=["我的留言", "/eden/ctl_eden.php?ctlOprType=get&ctlObj=msgs", "_blank"]
ssmItems[5]=["我的论坛", "/eden/forum/ctl_eden_forum.php", "_blank"]
ssmItems[6]=["我的博客", "/eden/blog/", "_blank"]
ssmItems[7]=["我的相册", "/eden/album/", "_blank"]
ssmItems[8]=["图片管理", "/eden/upload/ctl_upload.php", "_blank"]
ssmItems[9]=["高级搜索", "/eden/search_menu.html", "_blank"]
ssmItems[10]=["热线帮助", "http://hk.netsh.com/eden/bbs/154/", "_blank"]
ssmItems[11]=["退出登录", "/eden/ctl_eden_login.php?ctlOprType=put&ctlObj=login_out", ""]

if(IE)
{
    buildIEMenu();
}
else if(NS)
{
    buildNSMEnu();
}
else if(NS6)
{
    buildNS6MEnu();
}
else
{
    alert("不能运行!");
}

Javascript 相关文章推荐
学习YUI.Ext基础第一天
Mar 10 Javascript
extjs DataReader、JsonReader、XmlReader的构造方法
Nov 07 Javascript
jQuery使用动态渲染表单功能完成ajax文件下载
Jan 15 Javascript
js获得当前时区夏令时发生和终止的时间代码
Feb 23 Javascript
jQuery判断对象是否存在的方法
Feb 05 Javascript
js事件处理程序跨浏览器解决方案
Mar 27 Javascript
JavaScript基于原型链的继承
Jun 22 Javascript
使用jquery.qrcode.js生成二维码插件
Oct 17 Javascript
原生JS查找元素的方法(推荐)
Nov 22 Javascript
Vue.use源码分析
Apr 22 Javascript
使用vuex的state状态对象的5种方式
Apr 19 Javascript
微信小程序收藏功能的实现代码
Jun 19 Javascript
用javascript实现分割提取页面所需内容
May 09 #Javascript
javascript语句中的CDATA标签的意义
May 09 #Javascript
广告代码静态化js通用函数
May 09 #Javascript
用javascript实现自定义标签
May 08 #Javascript
javascript之对系统的toFixed()方法的修正
May 08 #Javascript
javascript之大字符串的连接的StringBuffer 类
May 08 #Javascript
Javascript中的数学函数集合
May 08 #Javascript
You might like
封装一个PDO数据库操作类代码
2009/09/09 PHP
php中sprintf与printf函数用法区别解析
2014/02/17 PHP
PHP远程采集图片详细教程
2014/07/01 PHP
php基于GD库画五星红旗的方法
2015/02/24 PHP
Javascript图像处理—平滑处理实现原理
2012/12/28 Javascript
JavaScript随机生成信用卡卡号的方法
2015/04/07 Javascript
JavaScript控制网页层收起和展开效果的方法
2015/04/15 Javascript
理解javascript定时器中的setTimeout与setInterval
2016/02/23 Javascript
利用jquery给指定的table动态添加一行、删除一行的方法
2016/10/12 Javascript
Vue.js划分组件的方法
2017/10/29 Javascript
vue 实现数字滚动增加效果的实例代码
2018/07/06 Javascript
vuex + axios 做登录验证 并且保存登录状态的实例
2018/09/16 Javascript
JavaScript实现抖音罗盘时钟
2019/10/11 Javascript
vue在App.vue文件中监听路由变化刷新页面操作
2020/08/14 Javascript
[01:14:19]NAVI vs Mineski 2019国际邀请赛淘汰赛 败者组BO1 8.20.mp4
2020/07/19 DOTA
python计算一个序列的平均值的方法
2015/07/11 Python
Python统计文件中去重后uuid个数的方法
2015/07/30 Python
Windows下Eclipse+PyDev配置Python+PyQt4开发环境
2016/05/17 Python
python基本语法练习实例
2017/09/19 Python
如何安装多版本python python2和python3共存以及pip共存
2018/09/18 Python
python实现简单多人聊天室
2018/12/11 Python
python多线程同步之文件读写控制
2021/02/25 Python
Python 最强编辑器详细使用指南(PyCharm )
2019/09/16 Python
python爬虫开发之urllib模块详细使用方法与实例全解
2020/03/09 Python
python传到前端的数据,双引号被转义的问题
2020/04/03 Python
python中wx模块的具体使用方法
2020/05/15 Python
Python正则表达式高级使用方法汇总
2020/06/18 Python
员工培训心得体会
2013/12/30 职场文书
服务承诺书怎么写
2014/05/24 职场文书
食品安全处置方案
2014/06/14 职场文书
涉外离婚协议书怎么写
2014/11/20 职场文书
劳资员岗位职责
2015/02/13 职场文书
高校自主招生教师推荐信
2015/03/23 职场文书
商场营业员岗位职责
2015/04/14 职场文书
使用Pytorch实现two-head(多输出)模型的操作
2021/05/28 Python
JavaScript 与 TypeScript之间的联系
2021/11/27 Javascript