js动态创建DIV,去掉数组中重复值
2013-05-19 12:31
363 查看
$("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);
}
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);
}
相关文章推荐