Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对编程很陌生。我看到了一个类似的例子,将特定单词标记为粗体或颜色,但不知道如何将其应用于各种字母/字符。例如,我想取一堆字符,让它们在任何文本中变为粗体或其他颜色。提前致谢!如果您能添加http://jsfiddle.net/演示,将不胜感激。
我不会为您提供完整且 100% 的答案,因为这不是本网站的工作方式,但我可以举个例子:
var text = 'something to replace'; var new_text = text.replace(/e/gi, ' WOW '); alert(new_text);
这应该足以让你开始。请根据您的情况进行尝试,并在下次指定您在尝试时收到的错误时随时发布带有代码的问题。
祝你好运!