Javascript搜索和替换
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Javascript搜索和替换相关的知识,希望对你有一定的参考价值。
Why doesn't this work?
var str="foobar"; var val="foo"; var search='/'+val+'/i'; alert(str.replace(search, '<strong>'+val+'</strong>')); // it alerts "foobar" and not "<strong>foo</strong>bar"
以上是关于Javascript搜索和替换的主要内容,如果未能解决你的问题,请参考以下文章