질문에 대한 답변의 하위 집합으로 구성된 jquery의 배열이 있지만 사용자가 & q에 도착하기 전에 기억을 위해 사용자에게 답변을 표시하려고합니다. 누군가가 어떻게 설명 할 수 있습니까 배열을 반복하고 각 이미지를 차례로 추출 할 수 있습니까?이 테이블을 반복하고 슬라이드 쇼에 대한 모든 정보를 추출하려면 어떻게합니까?
var infoTableIndex = 0;
j(function(){
j("#nextButton").click(
function(){
j("#slideshow").not(":animated").animate({"left": "500px", "opacity": "0.3"}, 1000,
function(i){
infoTableIndex++;
j("#slideshow").attr("src", imageAnswers.q1toQn[infoTableIndex].q1[i+1].src + ".png");
j("#slideshow").css("left", "-500px");
j("#slideshow").animate({"left": "40px", "opacity": "0.1"}, 500);
})
}//no sc
);
});
을 내가 오류는 다음과 같습니다 : 여기 등 등
및
var imageAnswers = {"q1toQn": [
{"q1": [
{"src": "./images/q1/cow", "alt": "cow", "id": "cow"},
{"src": "./images/q1/horse", "alt": "horse", "id": "horse"},
{"src": "./images/q1/pig", "alt": "pig", "id": "pig"},
{"src": "./images/q1/sheep", "alt": "sheep", "id": "sheep"}
]},
{"q2": [
{"src": "./images/q2/apple_", "alt": "apple", "id": "apple"},
{"src": "./images/q2/pear_", "alt": "pear", "id": "pear"},
{"src": "./images/q2/orange_", "alt": "orange", "id": "orange"},
{"src": "./images/q2/pineapple_", "alt": "pinaapple", "id": "pineapple"}
]},
{"q3": [
{"src": "./images/q3/chair", "alt": "chair", "id": "chair"},
{"src": "./images/q3/bookcase", "alt": "bookcase", "id": "bookcase"},
{"src": "./images/q3/chest", "alt": "chest", "id": "chest"},
{"src": "./images/q3/table", "alt": "table", "id": "table"}
]}, ...
내가 정보를 얻기 위해 노력하고있어 무엇
TypeError: Result of expression 'imageAnswers.q1toQn[infoTableIndex]' [undefined] is not an object.
감사합니다 사전에 도움을 청합니다.
가 디버깅나요 예를 들어 줄 경우 그것은 좋은 것'infoTableIndex'와'i' 당신이 무엇을 기대지고 보장하기 위해? –
내가 어떻게 알았 을까. 사용자 이름 : ChrisP <- n00b :( –