js刷新随机显示图片,怎么样才能点击得了?

以下刷新随机显示图片的,要怎么让他显示在html中能点击得了的,就是要怎么加上 href="url"。如何才能实现?
.


tips = new Array(2);
tips[0]="<img src=./img/aaa.gif style= width:100%;height:120px;>";
tips[1]="<img src=./img/bbb.gif style= width:100%;height:120px;>";
index = Math.floor(Math.random() * tips.length);
document.write(tips[index]);

就是在<img>标签外套一层<a></a>标签啊

你题目的解答代码如下:

tips = new Array(2);
tips[0]="<a href='aaa.html'><img src=./img/aaa.gif style= width:100%;height:120px;></a>";
tips[1]="<a href='bbb.html'><img src=./img/bbb.gif style= width:100%;height:120px;></a>";
index = Math.floor(Math.random() * tips.length);
document.write(tips[index]);

如有帮助,请点击我的回答下方的【采纳该答案】按钮帮忙采纳下,谢谢!

img