网上抓的一个特效


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 相关文章推荐
extjs 列表框(multiselect)的动态添加列表项的方法
Jul 31 Javascript
使用jquery mobile做幻灯播放效果实现步骤
Jan 04 Javascript
JQuery获取表格数据示例代码
May 26 Javascript
connect中间件session、cookie的使用方法分享
Jun 17 Javascript
JavaScript数值千分位格式化的两种简单实现方法
Aug 01 Javascript
JS常用算法实现代码
Nov 14 Javascript
理解javascript中的Function.prototype.bind的方法
Feb 03 Javascript
vue中计算属性(computed)、methods和watched之间的区别
Jul 27 Javascript
vue一个页面实现音乐播放器的示例
Feb 06 Javascript
vue用Object.defineProperty手写一个简单的双向绑定的示例
Jul 09 Javascript
vue中uni-app 实现小程序登录注册功能
Oct 12 Javascript
mpvue微信小程序开发之实现一个弹幕评论
Nov 24 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
PHP 转义使用详解
2013/07/15 PHP
PHP mysql事务问题实例分析
2016/01/18 PHP
PHP从二维数组得到N层分类树的实现代码
2016/10/11 PHP
php多进程模拟并发事务产生的问题小结
2018/12/07 PHP
PHP标准库 (SPL)――Countable用法示例
2020/06/05 PHP
js取得url地址参数实例
2013/02/22 Javascript
js阻止浏览器默认行为触发的通用方法(推荐)
2016/05/15 Javascript
AngularJS定时器的使用与移除操作方法【interval与timeout】
2016/12/14 Javascript
react性能优化达到最大化的方法 immutable.js使用的必要性
2017/03/09 Javascript
微信小程序中使用Promise进行异步流程处理的实例详解
2017/08/17 Javascript
通俗易懂地解释JS中的闭包
2017/10/23 Javascript
React native ListView 增加顶部下拉刷新和底下点击刷新示例
2018/04/27 Javascript
es6新特性之 class 基本用法解析
2018/05/05 Javascript
vue中对象数组去重的实现
2020/02/06 Javascript
基于JavaScript实现十五拼图代码实例
2020/04/26 Javascript
JS实现电脑虚拟键盘打字测试
2020/06/24 Javascript
Using Django with GAE Python 后台抓取多个网站的页面全文
2016/02/17 Python
老生常谈Python序列化和反序列化
2017/06/28 Python
python+matplotlib实现鼠标移动三角形高亮及索引显示
2018/01/15 Python
python 读取文本文件的行数据,文件.splitlines()的方法
2018/07/12 Python
详解python tkinter教程-事件绑定
2019/03/28 Python
Python数据类型之Dict字典实例详解
2019/05/07 Python
分享8点超级有用的Python编程建议(推荐)
2019/10/13 Python
Python udp网络程序实现发送、接收数据功能示例
2019/12/09 Python
keras得到每层的系数方式
2020/06/15 Python
python在linux环境下安装skimage的示例代码
2020/10/14 Python
HTML5使用DOM进行自定义控制示例代码
2013/06/08 HTML / CSS
金宝贝童装官网:Gymboree
2016/08/31 全球购物
异步传递消息系统的作用
2016/05/01 面试题
省优秀教师事迹材料
2014/01/30 职场文书
公司年会抽奖活动主持词
2014/03/31 职场文书
禁止酒驾标语
2014/06/25 职场文书
预备党员学习十八届三中全会精神思想汇报
2014/09/13 职场文书
单位租房协议书样本
2014/10/30 职场文书
2015年学校关工委工作总结
2015/04/03 职场文书
2016年中学法制宣传日活动总结
2016/04/01 职场文书