首页 > 语言 > JavaScript > 正文

一个js封装的不错的选项卡效果代码

2024-05-06 14:18:27
字体:
来源:转载
供稿:网友

代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>错新站长站 选项卡效果 www.Vevb.com</title>
<script type="text/javascript">
/*
    选项卡封装
    by 井底的蛙
    2008-2-4
*/
opCard = function()
{
    this.bind = new Array();
    this.index = 0;        //默认显示哪个选项卡,从0开始

    this.style = new Array();        //["","",""]
    this.overStyle = false;        //选项是否有over, out变换样式事件,样式为this.style[2]
    this.overChange = false;        //内容是否用over, out直接激活
    this.menu = false;                //菜单类型
    this.nesting = [false,false,"",""];        //是否嵌套,后面2个参数是指定menu,info的子集深度所用id

    this.auto = [false, 1000];        //自动滚动[true,2000]
    this.timerID = null;            //自动播放的
    this.menutimerID = null;        //菜单延时的

    this.creat = function(func)
    {
        var _arrMenu = document.getElementById(this.bind[0]).getElementsByTagName(this.bind[1]);
        var _arrInfo = document.getElementById(this.bind[2]).getElementsByTagName(this.bind[3]);
        var my = this, i;
        var argLen = arguments.length;
        var arrM = new Array();

        if(this.nesting[0] || this.nesting[1])    // 有选项卡嵌套
        {    // 过滤出需要的数据
            var arrMenu = this.nesting[0]?getChilds(_arrMenu,this.bind[0],2):_arrMenu;

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选