gpt4 book ai didi

Javascript 图像幻灯片在本地有效,但在托管时无效

转载 作者:行者123 更新时间:2023-11-28 10:38:11 25 4
gpt4 key购买 nike

看来你们是我的 javascript helper 。当我加载我的网页的本地副本时,我有一个完美的幻灯片。但是,当我加载托管在 GoDaddy 上的实际页面时,它不起作用。第一张图片显示,但只是静态的。控制台显示没有错误。再次感谢所有帮助。

<div class="auto-style1" style="width: 226px; height: 179px">
<script language="javascript" type="text/javascript">
var i = 0; var path = new Array();

// LIST OF IMAGES
path[0] = "images/image_1.png";
path[1] = "images/image_2.png";
path[2] = "images/image_3.png";
path[3] = "images/image_4.png";
path[4] = "images/image_5.png";
path[5] = "images/image_6.png";

function swapImage()
{
document.slide.src = path[i];
if(i < path.length - 1) i++;
else i = 0;
setTimeout("swapImage()",3000);
}
window.onload=swapImage;
</script>
<img alt="" name="slide" height="140" src="images/image_1.png" width="224" class="auto-style2" />
</div>

最佳答案

您的文件夹名称前需要有"/"

给出路​​径为

path[0] = "/images/image_1.png"; 
path[1] = "/images/image_2.png";
path[2] = "/images/image_3.png";
path[3] = "/images/image_4.png";
path[4] = "/images/image_5.png";
path[5] = "/images/image_6.png";

关于Javascript 图像幻灯片在本地有效,但在托管时无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23247603/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com