服务器之家 > 正文
<a href="1.htm">251</a> 怎么用JS把251替换为 <span style='background-color: #99FF99'>251</span>
<script type="text/javascript"> var str='<a href="1.htm">231</a>'; alert(str.replace(/<a([\s\S]*)>([\s\S]*)<\/a>/ig,"<a$1><span style='background-color: #99FF99'>$2</span></a>")); </script>