以下代码是按向上或者向下键的时候要执行的代码
所以有的程序都是正常由于有点长就不全部拷过来,
var highlightindex = -1;
if (keyCode == 38) {
var autoNodes = $("#auto").children("div");
if (highlightindex != -1) {
autoNodes.eq(highlightindex).css("background-color","white");
highlightindex--;
} else {
highlightindex = autoNodes.length -1;
}
if(highlightindex == -1) {
highlightindex = autoNodes.length - 1;
}
autoNodes.eq(highlightindex).css("background-color","red");
}
if (keyCode == 40) {
var autoNodes = $("#auto").children("div");
if (highlightindex != -1) {
autoNodes.eq(highlightindex).css("background-color","white");
}
highlightindex++;
if(highlightindex == autoNodes.length - 1) {
highlightindex = 0;
}
autoNodes.eq(highlightindex).css("background-color","red");
}
经本人调试代码一旦执行到
autoNodes.eq(highlightindex).css("background-color","white");
autoNodes.eq(highlightindex).css("background-color","red");
这两句程序就报
autoNodes.eq(highlightindex) not found
还有highlightindex的值总是0
哪位大哥大姐帮忙解决解决,,,,在此先谢过