html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dynamic Text Box</title>
<style>
#output-box {
width: 300px;
height: 100px;
border: 1px solid #ccc;
margin-top: 20px;
padding: 10px;
}
</style>
</head>
<body>
<button onclick="displayText('Hello, World!')">Show Text 1</button>
<button onclick="displayText('This is a different text.')">Show Text 2</button>
<div id="output-box"></div>
<script>
function displayText(text) {
var outputBox = document.getElementById('output-box');
outputBox.innerHTML = text;
}
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
body {
}
Enter to Rename, Shift+Enter to Preview
js
js
1
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run