替换(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>
posted @ 2018-11-01 10:32  0sakura0  阅读(200)  评论(0编辑  收藏  举报