-
Notifications
You must be signed in to change notification settings - Fork 1
/
online_editor.html
70 lines (69 loc) · 1.39 KB
/
online_editor.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html>
<head>
<title>Online turorial</title>
<style type="text/css">
body{
background-color: #eee;
padding: 0;
margin:0;
}
.main{
display: flex;
justify-content: space-around;
position: relative;
}
.html{
height: 70vh;
width: 48vw;
border:none;
resize: none;
box-shadow: 0 0 3px #666;
margin: 10px;
font-family: monospace;
font-size: 17px;
padding-left: 5px;
}
.out{
position: relative;
height: 70vh;
width: 48vw;
border: 1px solid #fff;
background-color: #fff;
top: 1px;
margin:10px;
box-shadow: 0 0 3px #666;
}
.white-space{
height: 18vh;
background-color: #fff;
}
.btn{
position: relative;
padding: 10px 20px;
top: 5px;
background-color: #04aa6d;
color: #fff;
border:none;
font-size: 20px;
cursor: pointer;
left: 43.8%;
}
</style>
</head>
<body>
<div class="white-space"></div>
<button type="button" onclick="run()" class="btn">Run</button>
<div class="main">
<textarea class="html" id="html" spellcheck="false"></textarea>
<iframe class="out" id="out"></iframe>
</div>
<script type="text/javascript">
function run(){
var html = document.getElementById("html").value;
var out = document.getElementById("out");
out.contentWindow.document.body.innerHTML = html;
}
</script>
</body>
</html>