标签:fun line data- ntb utf-8 doc get nbsp inner
替换单词Paul为Ringo:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<button onclick="myFunction()">click</button>
<p id="ag1">Paul,Paula,Pauline,paul,Paul</p>
<script>
function myFunction()
{
var str = document.getElementById("ag1").innerHTML;
var txt = str.replace("Paul","Ringo");
document.getElementById("ag1").innerHTML = txt;
}
</script>
</body>
</html>
标签:fun line data- ntb utf-8 doc get nbsp inner
原文地址:https://www.cnblogs.com/snowdeer/p/9906086.html