我尝试在 javascript 幻灯片上添加一些文本,但不知何故它不起作用。文本显示在顶部,幻灯片在文本下方循环播放。
如何使文本正确显示在图像上?请看一下
<html>
<head>
<script type="text/javascript">
<!--
var image1=new Image()
image1.src="firstcar.gif"
var image2=new Image()
image2.src="secondcar.gif"
var image3=new Image()
image3.src="thirdcar.gif"
//-->
</script>
</head>
<body>
<div style="width:100px; height:56px">
<div style="width:100px; height:56px; z-index:2">Tring to add some text on the top
<div style="width:100px; height:56px; z-index:1">
<img src="firstcar.gif" name="slide" width="100" height="56" />
</div>
</div>
</div>
<script>
<!--
var step=1
function slideit(){
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
if (step<3)
step++
else
step=1
setTimeout("slideit()",1500)
}
slideit()
//-->
</script>
</body>
</html>