需要将此幻灯片中的每个图像链接到我的网站上的其他页面。(Need to link each image in this slideshow to a different page on my site

编程入门 行业动态 更新时间:2024-10-10 21:25:24
需要将此幻灯片中的每个图像链接到我的网站上的其他页面。(Need to link each image in this slideshow to a different page on my site.)

我试图将每张图片/幻灯片链接到我网站上的某个页面,并且没有任何运气。 我环顾四周,找不到有效的答案。 这个幻灯片的效果令人惊叹,但我想让它更具互动性,并且不知道如何实现我想要的东西。

<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"

本文发布于:2023-08-01 03:07:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1354186.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:将此   幻灯   片中   图像   页面

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!