我将这张幻灯片放到了notepad ++和html中,并且在测试我的网站时图片不会改变。请帮助我将其更改为工作状态。另外,如果您有任何视频可能也可以帮助您解决这些问题。编辑软件重要吗?
<!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xht ml1/DTD/xhtml1-transitional.dtd"> -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
var image1=new image()
image1.src="theimage.png"
var image2=new image()
image2.src="soccerafrica.png"
var image3=new image()
image3.src="thatsall.png"
</script>
<style>
body.border{ border-style:solid;
border-width:20px;
border-color:#3C3;
margin: 0px;
}
@font-face{font-family: habara;
src: Harabara.ttf;}
div{font-family: habara; }
ul { list-style-type: none;
margin: 0px;
padding: 0px;
overflow: hidden;
}
li { display: inline-block;
width:250px;
margin: 0px;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Kinectricity</title>
</head>
<body class="border">
<p><pre>
</pre>
</p>
<h1 style="font-size:30px; background-color:#F90; margin:0px">
<ul>
<center>
<li><a href="">Home</a></li>
<li><a href="">About</a></li>
<li><img src="thatsall.png"height="145"width="145"</li>
<li><a href="">Order</a></li>
<li><a href="">Contact</a></li>
</center>
</ul>
</h1>
<p>
<pre>
</pre>
</p>
<center>
<h2 style="font-size: 50px; color:#7C3; margin:0px"><div>K i n e c t r i c i t y</div></h2>
</center>
<p>
<pre>
</pre>
</p>
<image src="theimage.png" name="slideshow" alt="imageslideshow" height="225" width="350">
<script type="text/javascript">
var numberImage = 1
function myslide()
{
document.images.slideshow.src=eval("image"+numberImage+".src")
if(numberImage < 3)
numberImage = numberImage + 1
else
numberImage = 1
setTimeout("myslide()" ,5000)
}
myslide()
</script>
</body>
</html>
最佳答案
可能是您忘记添加“;”在第一段脚本中的语句末尾?
像这样:
var image1 = new image();
image1.src =“ theimage.png”;
var image2 = new image();
image2.src =“ soccerafrica.png”;
var image3 = new image();
image3.src =“ thatsall.png”;
关于javascript - Javascript和HTML幻灯片,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34600257/