实现字母转换
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div>
<button onclick="pot1()">点击</button>
<p>Paul,Paula,Pauline,paul,Paul</p>
<p id="pot">Paul,Paula,Pauline,paul,Paul</p>
<script type="text/javascript">
function pot1(){
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div>
<button onclick="pot1()">点击</button>
<p>Paul,Paula,Pauline,paul,Paul</p>
<p id="pot">Paul,Paula,Pauline,paul,Paul</p>
<script type="text/javascript">
function pot1(){
var str="Paul,Paula,Pauline,paul,Paul";
var text=str.replace(/\bPaul\b/g,"Ringo");
document.getElementById("pot").innerHTML=text;
}
var text=str.replace(/\bPaul\b/g,"Ringo");
document.getElementById("pot").innerHTML=text;
}
</script>
</div>
</body>
</html>
</div>
</body>
</html>