我嘗試在javascript幻燈片上添加一些文本,但不知何故,它不工作。文本顯示在頂部,幻燈片顯示在文本下面循環播放。在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>
可以的,如果你想要的文字爲圖像(不接觸)你上面澄清或在圖像的頂部? –
我的意思是文字在圖像上顯示正確。 –