<!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>字体标红</title> </head> <body> 我是红色的字体我是红色的字体我是红色的字体我是红色的字体我是红色的字体 <span style='color: red;'></span> <script type="text/javascript"> document.body.innerHTML = document.body.innerHTML.replace(/红/ig,"<span style='color: red;'>$&</span>"); </script> </body> </html>