내 코드가 무엇인지 잘못 알지만 실제로 HTML을 미리 볼 때 제대로 작동하지 않습니다. 나는 무엇이라도 놓치지 않았다!?내 자바 스크립트는 어떻게됩니까? 제대로 작동하지 않습니다.
클릭하면 g1과 g2가 잘 작동하지만 g2를 g 버튼으로 클릭하면 g3으로 표시되지만 g4로 이동하고 위/아래 버튼이 더 이상 작동하지 않습니다. (
function chgPic(id) {
$('#show').attr('src', id).stop(true, true).hide().fadeIn();
}
//tooltip (rename the element to put tooltip on it "title")
//$(document).ready(function() {
// $("#simple").tiptip();
//});
function up() {
if (document.getElementById('g1').style.display == 'block') {
$('#g1').show();
$('#g2').hide();
$('#g3').hide();
$('#g4').hide();
}
else if (document.getElementById('g2').style.display == 'block') {
$('#g1').show();
$('#g2').hide();
$('#g3').hide();
$('#g4').hide();
}
else if (document.getElementById('g3').style.display == 'block') {
$('#g1').hide();
$('#g2').show();
$('#g3').hide();
$('#g4').hide();
}
else if (document.getElementById('g4').style.display == 'block') {
$('#g1').hide();
$('#g2').hide();
$('#g3').show();
$('#g4').hide();
}
else {
$('#g1').hide();
$('#g2').hide();
$('#g3').hide();
$('#g4').show();
}
}
function down() {
if (document.getElementById('g1').style.display == 'block') {
$('#g1').hide();
$('#g2').show();
$('#g3').hide();
$('#g4').hide();
}
else if (document.getElementById('g2').style.display == 'block') {
$('#g1').hide();
$('#g2').hide();
$('#g3').show();
$('#g4').hide();
}
else if (document.getElementById('g3').style.display == 'block') {
$('#g1').hide();
$('#g2').hide();
$('#g3').hide();
$('#g4').show();
}
else {
$('#g1').hide();
$('#g2').hide();
$('#g3').hide();
$('#g4').show();
}
}
down 함수에서 else if (document.getElementById ('g4'). style.display == '블록')는 어디에 있습니까? –
[JSFiddle] (http://www.jsfiddle.net/)을 HTML과 함께 추가하고 수행하려는 작업을 설명하십시오. – MarcoK
@AristonAlcantara : '업'의 첫 번째 것이 필요하지 않은 것처럼 필요하지 않습니다. – Guffa