我有以下代码,我使用 php 文件读取文件夹的内容,将其放入数组中,然后使用 Jquery Cycle 插件进行幻灯片放映。
<html>
<meta http-equiv="refresh" content="1000"/>
head>
<title>Media Signage Slideshow</title>
<style type="text/css">
#myslides {
width: 370px;
height: 220px;
padding: 0;
margin: 0 auto;
}
</style>
</head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript" src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#myslides').cycle({
fx: 'fade',
speed: 5000,
timeout: 2000
});
});
</script>
<script type="text/javascript">
var curimg=0;
function rotateimages(){
galleryarray.sort();
document.getElementById("myslides").setAttribute("src", "images/"+galleryarray[curimg]);
curimg = (curimg+1) % galleryarray.length;
}
window.onload = function(){
setInterval("rotateimages()", 5000);
}
/script>
<script type="text/javascript" language="JavaScript" src="./code.php"></script>
<body>
<div id="myslides">
<!--<img src="100.jpg" />
<img src="101.jpg" /> -->
</div>
</body>
</html>
当我改变时:
<div id="myslides">
至
<img id="myslides">
我的幻灯片工作正常,但使用 div id 我什么也看不到。如何解决这个问题?