js动态创建DIV,去掉数组中重复值

$("a").mouseenter(function () {
                var setx = this.offsetLeft;
                var sety = this.offsetTop;
                //alert(setx + "," + sety);
                $("#showd").css({
                    'top': sety + 20 + 'px',
                    'left': setx + 50 + 'px',
                    'position': 'absolute',
                    'background': 'gray'
                }).show();
            });
            $("#showd").mouseout(function () {
                $(this).hide();
            });
            $("#showd").click(function () {
                alert("可以了");
            });
        });
        function getr() {

            var fn = 1;  //文件名称
            var te = "2,3,4,1";
            var temp = 0;
            var tem = te.split(',');
            $.each(tem, function (n, value) {
                if (value == fn) {
                    temp = n;
                }
            });
            tem.splice(temp, 1);
            alert(tem);
        }

posted @ 2013-05-19 12:31  BicycleBoy  阅读(243)  评论(0编辑  收藏  举报