将#hash标记更改为页面加载时链接 [英] Change #hash tag to link on page load
本文介绍了将#hash标记更改为页面加载时链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用javascript更改#tag +字符链接
How to change # tag + Character to link using javascript
This is going #right on the way
with
This is going <a href="http://twitter.com/#!/search/right">right</a> on the way
即使这也是可以接受的
This is going <a href="http://twitter.com/#!/search/right">#right</a> on the way
不同类和ID的#(hash)标签的页面批次
The page lots's of # (hash) tag in different classes and id's
推荐答案
var string = "This is going #right on the way";
string.replace(/#(\S*)/g,'<a href="http://twitter.com/#!/search/$1">$1</a>')
演示: http://jsfiddle.net/dKm82/
这篇关于将#hash标记更改为页面加载时链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文