我想为114 div应用鼠标事件。有一个div有很多条件。我写了一个div,但大约有900行。如果我想为114 div做这件事,这将是非常困难和无聊。我尝试了下面的例子,但没有奏效。在鼠标事件中使用数组
var abc= new Array();
abc[0] = ".ABC";
abc[1] = ".DEF";
$(abc).mouseenter(function() {
Some code
});
或
for (var a=0;a<114;a++) {
$(abc[a]).mouseenter(function() {
Some code
});
}
或
while (var a=0;a<114;a++) {
$(abc[a]).mouseenter(function() {
Some code
});
}
你确定你要定义114倍,而不是总是指同一 –
同样的功能@ Siamak.AM哦。我一整天都在工作。我想不出来。 :) 谢谢。 – Zeki