Result Size: 625 x 534
x
 
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript 正则表达式</h2>
<p>将以下段落中的“microsoft”替换为“BEGTUT”:</p>
<button onclick="myFunction()">试一试</button>
<p id="demo">Please visit Microsoft and Microsoft!</p>
<script>
function myFunction() {
  var str = document.getElementById("demo").innerHTML; 
  var txt = str.replace(/microsoft/i,"BEGTUT");
  document.getElementById("demo").innerHTML = txt;
}
</script>
</body>
</html>