【发布时间】:2011-10-26 10:55:45
【问题描述】:
我需要一些帮助来创建 jquery 脚本 :)
我的 HTML 上有一些这样的链接。
<a href="http://google.com">Google</a>
<a href="/">Home</a>
<a href="http://www.gusdecool.com/">Home</a>
<a href="contactus.html">Contact Us</a>
现在我希望 jQuery 检查我页面上的所有链接。如果该链接在我的服务器之外(我的服务器是gusdecool.com)。然后添加target="_blank"。结果会是这样的
<a href="http://google.com" target="_blank">Google</a>
<a href="/">Home</a>
<a href="http://www.gusdecool.com/">Home</a>
<a href="contactus.html">Contact Us</a>
【问题讨论】:
标签: javascript jquery