-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathdemo.html
36 lines (33 loc) · 952 Bytes
/
demo.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta name="author" content="DH">
<title>代码预览插件jquery.runCode.js</title>
<link rel="stylesheet" href="./jquery.runCode.css">
<style>
.playcode{
width: 400px;
height: 100px;
background-color: #f3f3f3;
}
</style>
</head>
<body>
<div class="main">
<textarea class="playcode"></textarea> <br>
<button id="start">run code</button>
</div>
<script src="./jquery.min.js"></script>
<script src="./jquery.runCode.js"></script>
<script>
var str="<h1>runCode.js</h1>\n\n\<style\>h1{color:red}\</style\>\n\n\<script\>document.write('代码预览插件')\</script\>";
$(".playcode").text(str)
$("#start").on('click', function() {
$(".playcode").runCode();
})
</script>
</body>
</html>