-4
<a href="examplewebsite.com" onclick="window.open('anewexample.com/index.html')">Click here</a>

When published and clicked, the link is www.examplewebsite.com/www.anewexample.com/index.html

Ive removed the href code and it doesnt work at all. If anyone can help, then im happy to listen.

4

3 回答 3

2

您使用的是相对 href 而不是绝对链接...

尝试在开头添加 http://。

至少通过发布您的代码,让您的问题下次更完整。

于 2013-04-03T13:16:12.770 回答
2

当你写<a>标签时,href 必须http://在它之前。如果不是,浏览器会认为您引用的是相对路径。所以添加http://它会起作用。

于 2013-04-03T13:17:39.360 回答
0

您应该尝试不使用 onclick:

<a href="http://www.examplewebsite.com" target="_blank">Click here!</a>

这种方式容易多了。

于 2013-04-03T13:28:47.500 回答