-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
42 lines (38 loc) · 1.57 KB
/
index.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<script src="https://kit.fontawesome.com/df2957c15c.js" crossorigin="anonymous"></script>
<title>webSquare</title>
</head>
<body>
<h1 class="top"><i class="fa-brands fa-square-odnoklassniki"></i>webSquare</h1>
<div class="square">
<div class="input">
<label><i class="fa-brands fa-html5"></i>HTML</label>
<textarea id="html" onkeyup="run()"> </textarea>
<label><i class="fa-brands fa-css3-alt"></i>CSS</label>
<textarea id="css" onkeyup="run()"></textarea>
<label><i class="fa-brands fa-js"></i>JavaScript</label>
<textarea id="js" onkeyup="run()"></textarea>
</div>
<div class="output">
<label><i class="fa-solid fa-play"></i>WEB-VIEW</label>
<iframe id="code-output"></iframe>
</div>
</div>
<script>
function run(){
let htmlCode = document.getElementById("html").value;
let cssCode = document.getElementById("css").value;
let jsCode = document.getElementById("js").value;
let output = document.getElementById("code-output");
output.contentDocument.body.innerHTML = htmlCode + "<style>" + cssCode + "<style>";
output.contentWindow.eval(jsCode);
}
</script>
</body>
</html>