我为滑块编写了一个JavaScript代码。此代码在localhost或offline中运行。但它不是在线或我的服务器上运行的。我用这个代码。请帮我。我尝试但不解决它。我哪里错了?
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript">
var imagecount=1;
var total=5;
function slide(x){
var Image = document.getElementById('img');
imagecount = imagecount + x;
if(imagecount > total)
{
imagecount=1;
}
if (imagecount < 1)
{
imagecount = total;
}
Image.src = "img/image" + imagecount + ".jpg";
}
window.setInterval(function slideA(){
var Image = document.getElementById('img');
imagecount = imagecount + 1;
if(imagecount > total)
{
imagecount=1;
}
if (imagecount < 1)
{
imagecount = total;
}
Image.src = "img/image" + imagecount + ".jpg";
},5000);
</script>