我试图将每张图片/幻灯片链接到我网站上的某个页面,并且没有任何运气。 我环顾四周,找不到有效的答案。 这个幻灯片的效果令人惊叹,但我想让它更具互动性,并且不知道如何实现我想要的东西。
<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>幻灯片放映效果很好,但我完全不知道如何将这些幻灯片链接到我网站上的特定页面。 请帮忙!! 谢谢!
I am trying to link each picture/slide to a certain page on my site and am having no luck whatsoever. I have looked around and haven't been able to find an answer that works. This slideshow works amazing as is, but I want to make it more interactive and am at a loss as to how to achieve what I want.
<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>The slide show works great, but I am at a complete loss as to how I would go about linking each of these slides to a specific page on my site. Please help!! Thanks!
最满意答案
您可以尝试使用<a> </a>包装图片:
<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]);You can try wrapping the image with <a></a>:
<a id="thelink"><img src="Images/abouthome.jpg" name="slide" width=1080 height=400></a>And then above when you declare the image variables, declare your page URLS:
var links = ["http://www.example.com/page1", "http://www.example.com/pae2"];And then in the slideit() function, add the link:
document.getElementById("thelink").setAttribute("href", links[step]);更多推荐
slide,image,电脑培训,计算机培训,IT培训"/> <meta name="description"
发布评论