RSS订阅优然探索
你的位置:首页 » 技术文章 » 正文

asp.net 三级菜单的JS代码

选择字号: 超大 标准 发布时间:2009-12-21 17:2:25 | 作者:admin | 0个评论 | 人浏览

 var cur_id = "";
        var flag = 0, sflag = 0;

        //-------- 菜单点击事件 -------
        function c(srcelement) {
            var targetid, srcelement, targetelement;
            var strbuf;

            //-------- 如果点击了展开或收缩按钮---------
            targetid = srcelement.id + "d";
            targetelement = document.getElementById(targetid);

            if (targetelement.style.display == "none") {
                srcelement.className = "active";
                targetelement.style.display = '';

                menu_flag = 0;
                expand_text.innerHTML = "收缩";
            }
            else {
                srcelement.className = "";
                targetelement.style.display = "none";

                menu_flag = 1;
                expand_text.innerHTML = "展开";
                var links = document.getElementsByTagName("A");
                for (i = 0; i < links.length; i++) {
                    srcelement = links[i];
                    if (srcelement.parentNode.className.toUpperCase() == "L1" && srcelement.className == "active" && srcelement.id.substr(0, 1) == "m") {
                        menu_flag = 0;
                        expand_text.innerHTML = "收缩";
                        break;
                    }
                }
            }
        }
        function set_current(id) {
            cur_link = document.getElementById("f" + cur_id)
            if (cur_link)
                cur_link.className = "";
            cur_link = document.getElementById("f" + id);
            if (cur_link)
                cur_link.className = "active";
            cur_id = id;
        }
        //-------- 打开网址 -------
        function a(URL, id) {
            set_current(id);
            if (URL.substr(0, 7) != "http://" && URL.substr(0, 6) != "ftp://")
                URL = "/general/" + URL;
            parent.openURL(URL, 0);
        }
        function b(URL, id) {
            set_current(id);
            URL = "/app/" + URL;
            parent.openURL(URL, 0);
        }
        //add by YZQ 2008-03-05 begin
        function bindFunc() {
            var args = [];
            for (var i = 0, cnt = arguments.length; i < cnt; i++) {
                args[i] = arguments[i];
            }
            var __method = args.shift();
            var object = args.shift();
            return (
    function() {
        var argsInner = [];
        for (var i = 0, cnt = arguments.length; i < cnt; i++) {
            argsInner[i] = arguments[i];
        }
        return __method.apply(object, args.concat(argsInner));
    });
        }
        var timerId = null;
        var firstTime = true;
        //add by YZQ 2008-03-05 end
        function d(URL, id) {
            //add by YZQ 2008-03-05 begin
            var winMgr = parent.parent.table_index.main.winManager;
            if (!winMgr) {
                if (firstTime) {
                    parent.openURL("http://www.codefans.net", 0);
                    firstTime = false;
                }
                timerId = setTimeout(bindFunc(d, window, URL, id), 100);
                return;
            }
            firstTime = true;
            if (timerId) {
                clearTimeout(timerId);
            }
            if (winMgr) {
                winMgr.openActionPort("/fis/" + URL, document.getElementById("f" + id).innerText);
                return;
            }
            //add by YZQ 2008-03-05 end

            set_current(id);
            URL = "/fis/" + URL;
            parent.openURL(URL, 0);
        }
        //-------- 菜单全部展开/收缩 -------
        var menu_flag = 1;
        function menu_expand() {
            if (menu_flag == 1)
                expand_text.innerHTML = "收缩";
            else
                expand_text.innerHTML = "展开";

            menu_flag = 1 - menu_flag;

            var links = document.getElementsByTagName("A");
            for (i = 0; i < links.length; i++) {
                srcelement = links[i];
                if (srcelement.parentNode.className.toUpperCase() == "L1" || srcelement.parentNode.className.toUpperCase() == "L21") {
                    targetelement = document.getElementById(srcelement.id + "d");
                    if (menu_flag == 0) {
                        targetelement.style.display = '';
                        srcelement.className = "active";
                    }
                    else {
                        targetelement.style.display = "none";
                        srcelement.className = "";
                    }
                }
            }
        }

        //-------- 打开windows程序 -------
        function winexe(NAME, PROG) {
            URL = "/general/winexe?PROG=" + PROG + "&NAME=" + NAME;
            window.open(URL, "winexe", "height=100,width=350,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top=0,left=0,resizable=no");
        }

标签:

猜你喜欢

发表评论

必填

选填

选填

必填,不填不让过哦,嘻嘻。

记住我,下次回复时不用重新输入个人信息

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。