我正在尝试将每张照片/幻灯片链接到我网站上的某个页面,并且没有任何运气。我环顾四周,找不到有效的答案。这个幻灯片的效果令人惊叹,但我想让它更具互动性,并且不知道如何实现我想要的东西。
<style type="text/css">
.jj {
text-align: center;
}
</style>
<div align="center"></div>
<table width="1080" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#404040"><table width="1080" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="jj"><head>
<script type="text/javascript">
<!--
var image1=new Image()
image1.src="Images/abouthome.jpg"
var image2=new Image()
image2.src="Images/instructhome.jpg"
var image3=new Image()
image3.src="Images/awardhome.jpg"
//-->
</script>
<style type="text/css">
.fasda {
text-align: center;
}
</style>
</head>
<body class="fasda">
<img src="Images/abouthome.jpg" name="slide" width=1080 height=400>
</body>
<script type="text/javascript">
<!--
//variable that will increment through the images
var step=1
function slideit(){
//if browser does not support the image object, exit.
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
if (step<10)
step++
else
step=1
//call function "slideit()" every 5 seconds
setTimeout("slideit()",6000)
}
slideit()
//-->
</script></td>
</tr>
</table>
</table>
幻灯片放映效果很好,但我完全不知道如何将这些幻灯片链接到我网站上的特定页面。请帮忙!! 谢谢!
答案 0 :(得分:0)
您可以尝试使用&lt; a&gt;&lt; / a&gt;包装图片:
<a id="thelink"><img src="Images/abouthome.jpg" name="slide" width=1080 height=400></a>
然后在声明图像变量时,请声明页面URL:
var links = ["http://www.example.com/page1", "http://www.example.com/pae2"];
然后在slideit()函数中添加链接:
document.getElementById("thelink").setAttribute("href", links[step]);