网络编程
位置:首页>> 网络编程>> 网页设计>> 另外一种斜体的导航条(2)

另外一种斜体的导航条(2)

作者:快乐笛子 来源:快乐笛子的博客 发布时间:2008-11-05 12:24:00 

标签:导航,导航条,淘宝,倾斜

原来在 firefox 下,一个空格或回车都算一个节点。今天稍微调整一下页面,把导航条的ul写成一行,并修改了js,兼容了ie 与 ff,而且更加简洁了。

Sample: http://www.happyshow.org/sample/20060617/index.html

// JavaScript Document
   
    function preset()
    {
        document.getElementById("itemlist").childNodes[selectindex].firstChild.firstChild.className="style1";
        document.getElementById("itemlist").childNodes[selectindex+1].childNodes[0].childNodes[0].className="style2";
        innersubclass();
    }
    function focusthis(obj)
    {
        clearselect();
        obj.className = "style1";
        obj.parentNode.parentNode.nextSibling.firstChild.firstChild.className="style2";
        innersubclass(obj);
    }
    function innersubclass(obj)
    {
        if (obj==null)
        {
            document.getElementById("subclass").innerHTML = subclass[selectindex];
        }else
        {
            for(i=0; i<obj.parentNode.parentNode.parentNode.childNodes.length;i++)
            {
                if(obj == document.getElementById("itemlist").childNodes[i].firstChild.firstChild)
                {
                    document.getElementById("subclass").innerHTML = subclass[i];
                }
            }
        }
    }
    function recover()
    {
        clearselect();   
        preset();
        innersubclass();
    }
    function clearselect()
    {
        for (i=0; i<document.getElementById("itemlist").childNodes.length; i++)
        {
            document.getElementById("itemlist").childNodes[i].firstChild.firstChild.className="style0";
        }   
    }   

 

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com