<script type="text/javascript">
$(function(){
var slides= ["<?php echo $slider[0]; ?>", "<?php echo $slider[1]; ?>", "<?php echo $slider[2]; ?>"];
var firstSlide = [1, 2, 0];
var lastSlide = [2, 0, 1];
var i = 0;
var j = 0;
function degistir(){
$("#leftslide").attr("src", "admin/slider/"+slides[firstSlide[i]]);
$("#rightslide").attr("src", "admin/slider/"+slides[lastSlide[j]]);
i += 1;
j += 1;
if(i == 2) i = 0;
if(j == 2) j = 0;
}
setInterval('degistir()',5500);
});
</script>
&#34; degistir&#34;函数在$(function(){})
中不起作用,但是当我将它带到另一个<script type="text/javascript"></script>
时,我无法将数组传递给另一个脚本。那我该怎么办?
答案 0 :(得分:2)