gpt4 book ai didi

html - 随机图片-如何添加链接?

转载 作者:太空宇宙 更新时间:2023-11-04 05:21:02 26 4
gpt4 key购买 nike

如何添加指向这些随机图像集的链接。我想要分别指向 A B 和 C 的链接,并且我希望这些颜色能够匹配。在我正在处理的页面(我自己的个人艺术网站)中,这些颜色将是图像。

http://rollinleonard.com/please-help/

<!DOCTYPE html> 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Rollin Leonard</title>
</head>
<body>
<SCRIPT LANGUAGE="Javascript">
function banner() { } ; b = new banner() ; n = 0
b[n++]= "<IMG name=randimg SRC='http://rollinleonard.com/please-help/images/green_01.gif' border='0' ALT=''><IMG name=randimg SRC='http://rollinleonard.com/please-help/images/green_02.gif' border='0' ALT=''><IMG name=randimg SRC='http://rollinleonard.com/please-help/images/green_03.gif' border='0' ALT=''>"
b[n++]= "<IMG name=randimg SRC='http://rollinleonard.com/please-help/images/purple_01.gif' border='0' ALT=''><IMG name=randimg SRC='http://rollinleonard.com/please-help/images/purple_02.gif' border='0' ALT=''><IMG name=randimg SRC='http://rollinleonard.com/please-help/images/purple_03.gif' border='0' ALT=''>"
b[n++]= "<IMG name=randimg SRC='http://rollinleonard.com/please-help/images/yellow_01.gif' border='0' ALT=''><IMG name=randimg SRC='http://rollinleonard.com/please-help/images/yellow_02.gif' border='0' ALT=''><IMG name=randimg SRC='http://rollinleonard.com/please-help/images/yellow_03.gif' border='0' ALT=''>"
i=Math.floor(Math.random() * n) ;
document.write( b[i] )
</SCRIPT>
</body>
</html>

最佳答案

或者,正如 Rodaine 所说,您可以将代码更改为:

b[n++]= "<a href='http://url.com'><IMG SRC='green_01.gif'></a><a href='http://url2.com'><IMG SRC='green_02.gif'></a><a href='http://url3.com'><IMG SRC='green_03.gif'></a>"

但更好的考虑是图像映射。
看来您有一张已剪切的图像,现在正用于不同的链接。如果是这种情况,请查看 http://www.w3schools.com/TAGS/tryit.asp?filename=tryhtml_areamap这是此处信息的 Playground :http://www.w3schools.com/TAGS/tag_map.asp

关于html - 随机图片-如何添加链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6552863/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com