-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
34 lines (33 loc) · 854 Bytes
/
index.html
File metadata and controls
34 lines (33 loc) · 854 Bytes
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Paste → live</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<script>
(function() {
// render form page
document.body.innerHTML = `
<h1>Paste HTML → live</h1>
<form id="form">
<textarea id="code" style="width:100%;height:300px;"></textarea><br>
<button type="submit">Render HTML</button>
</form>
<p style="color:#666;font-size:14px">
Your code will replace this page immediately.
</p>
`;
document.getElementById("form").addEventListener("submit", e => {
e.preventDefault();
const val = document.getElementById("code").value;
// directly replace the current document
document.open();
document.write(val);
document.close();
});
})();
</script>
</body>
</html>