替换(replace)

<!DOCTYPE html>
<html>
<head>
 <meta charset="utf-8">
</head>
<body>
    <button onclick="replace()">replace</button>
    <p id="a">poau,Pula,Paul,PAUL</p>
 <script>
  function replace() {
   var b = document.getElementsById('a').innerHTML;
   var c = b.replace("Paul","Ringo");
   document.getElementsById("a").innerHTML = c;
  }
 </script>
</body>
</html>
原文地址:https://www.cnblogs.com/0sakura0/p/9887845.html