這一切似乎很好,只是真正奇怪的是,當我嘗試引用var與.html('g'+索引)它引發對象預期的錯誤。我猜構建變種不是最好的事情?使用.html時奇怪的對象預計錯誤
var g0 = "<?php getFiles("gallery/Audience"); ?>";
var g1 = "<?php getFiles("gallery/Exhibition"); ?>";
var g2 = "<?php getFiles("gallery/registration"); ?>";
var g3 = "<?php getFiles("gallery/Speakers"); ?>";
$(".galleryButton").each(function (index) {
$(this).click(function(){
$('#galleria').html();
$('#galleria').html('g'+index);
initiateGallery();
}).mouseover(function() {
$(this).css('cursor', 'pointer');
$(this).css('backgroundColor', '#002E53');
}).mouseout(function(){
$(this).css('backgroundColor', '#000');
});
});
你想用'$('#galleria')。html();''來完成什麼? – 2011-03-24 10:25:53