我尝试构建的这个网站上的脚本有问题。这是脚本本身:
var id=0;
var cases=$('.cases').length;
$('#show').html($('#'+id).html());
setInterval(function()
{
$('#show').empty();
if (id==cases-1)
id=0;
else
id++;
$('#show').html($('#'+id).html());
},5000);
这是html代码:
<div class="page">
<br /><br /><headline>cases</headline><br /><br /><div id='case'></div><div class='content'><div id='show'></div><div id='column1'><div class='cases' id='0'><div class='short'><div id='cases-image'><img src='images/Sunset.jpg'/></div><div id='cases-info'><div id='cases-headline'>zxfbzsxdbfsdfh</div><cases-text>dfghsdfgsdfgsdfg</cases-text><div class='more' id=zxfbzsxdbfsdfh >להמשך קריאה...</div></div></div></div></div><div id='column2'><div class='cases' id='1'><div class='short'><div id='cases-image'><img src='images/גלריה1.bmp'/></div><div id='cases-info'><div id='cases-headline'>xbzsdfbsdf</div><cases-text>dafasdvasdvasdv</cases-text><div class='more' id=xbzsdfbsdf >להמשך קריאה...</div></div></div></div></div> </div>
<div id="footer">
</div>
它在 jsFiddle 中工作,但在我的计算机上不起作用,它只显示第一种情况,脚本中的 id 发生变化,但它没有从其他情况下获取 html ......你能帮帮我吗?