这是我的 Javascript 位于头部顶部。
<script type="text/javascript" charset="utf-8">
var myGallery=new Array();
myGallery[0]="../images/gallery2/2009_09_04-BretErnst_0013.jpg";
</script>
现在我希望能够调用 myGallery[0] 并将其用作 href。
所以我尝试:
<li>
<a href="myGallery[0]" rel="prettyPhoto[gallery1]" title="You can add caption to pictures. You can add caption to pictures. You can add caption to pictures.">
<img src="myGallery[0]" width="60" height="60" alt="Red round shape" />
</a>
</li>
但是变量没有被字符串替换...
帮忙?
最佳答案
怎么样<a href="" onclick="location.href=myGallery[0];return false;">image</a>
关于javascript - 在 HTML URL 中使用数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11938774/