-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1k.html
23 lines (22 loc) · 882 Bytes
/
1k.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE html>
<html lang="en">
<head>
<title>JS Tutorials 155</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1>JavaScript String Methods</h1>
<p>Try to replace "Microsoft" with "W3Schools" in the paragraph below:</p>
<button onclick="changeText()">Try it</button>
<p id="target">Please visit Microsoft!</p>
<p>The replace() method is case sensitive. MICROSOFT (with upper-case) will not replaced.</p>
</body>
<script>
function changeText() {
let txt = document.getElementById("target").innerHTML;
document.getElementById('target').innerHTML = txt.replace("MICROSOFT", "W3Schools");
}
</script>
</html>