JS实现的简单横向伸展二级菜单

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>JS实现的简单横向伸展二级菜单_网页代码站(www.webdm.cn)</title>
    <style type="text/css">
        .suckerdiv { }
        .suckerdiv ul { width: 120px; position: relative; }
        .suckerdiv ul li ul { left: 120px; /* Parent menu width - 1*/ position: absolute; width: 140px; /*sub menu width*/ top: 0; display: none; }
            /*All subsequent sub menu levels offset */
        .suckerdiv ul li ul li ul { left: 159px; /* Parent menu width - 1*/ }
            /* menu links style */
        .suckerdiv ul li a { display: block; color: #353302; text-decoration: none; font:12px 宋体; background: #eee; line-height:24px; padding: 0px 10px; border: 1px solid #fff; border-bottom: 0; }
        .suckerdiv ul li a:visited { color: black; }
        .suckerdiv ul li a:hover{ color: white; background-color: #97c839; }
        .suckerdiv .subfolderstyle { }
        .suckerdiv a.subfolderstyle:hover { background: #97c839 url() no-repeat center right; }
    </style>
</head>
<body>
<script type="text/javascript">
    var menuids = ["suckertree1"]
    function buildsubmenus() {
        for (var i = 0; i < menuids.length; i++) {
            var ultags = document.getElementById(menuids[i]).getElementsByTagName("ul")
            for (var t = 0; t < ultags.length; t++) {
                ultags[t].parentNode.getElementsByTagName("a")[0].className = "subfolderstyle"
                ultags[t].parentNode.onmouseover = function () {
                    this.getElementsByTagName("ul")[0].style.display = "block";
                    this.firstChild.style.backgroundColor = 'green';
                }
                ultags[t].parentNode.onmouseout = function () {
                    this.getElementsByTagName("ul")[0].style.display = "none"
                    this.firstChild.style.backgroundColor = '';
                }
            }
        }
    }
    if (window.addEventListener)
        window.addEventListener("load", buildsubmenus, false)
    else if (window.attachEvent)
        window.attachEvent("onload", buildsubmenus)
</script>
<div class="suckerdiv">
    <ul id="suckertree1">
        <li><a href="#">腾讯新闻</a></li>
        <li><a href="#">腾讯汽车</a></li>
        <li><a href="#">腾讯科技</a></li>
        <li><a href="#">腾讯手机</a>
            <ul>
                <li><a href="#">HTC</a></li>
                <li><a href="#">联想</a></li>
                <li><a href="#">华为</a></li>
                <li><a href="#">中兴</a></li>
            </ul>
        </li>
    </ul>
</div>
<br>
<p><a href="http://www.webdm.cn">网页代码站</a> - 最专业的网页代码下载网站 - 致力为中国站长提供有质量的网页代码!</p>
</body>
</html>

上一篇:bash: jar: 未找到命令..(command not found)


下一篇:在VS中如何用C++连接Mysql