简体   繁体   English

用JavaScript更新URL不起作用

[英]Update URL with JavaScript doesn't work

I'm trying to change the url of some tag using another one. 我正在尝试使用另一个标签来更改某些标签的网址。 Can't get it to work. 无法正常工作。 Please help. 请帮忙。

Here's my code: 这是我的代码:

<a href="#" rel="wd" onclick="updateUrl('wd')">Category</a>

<a id="test" href="index.php?path=portfolio/web" class="thumbnail"><img src="img.jpg"></a>

<script type="text/javascript">
function updateUrl(newUrl)
{
    document.links["test"].href .= newUrl;
}
</script>
document.links['test'].href += newUrl;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM