dynamic-load.html
905 字节
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
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Dynamic Load Examples</title>
<style>
form {
margin: 0;
}
textarea {
display: block;
}
</style>
<script charset="utf-8" src="jquery.js"></script>
<script>
$(function() {
$('input[name=load]').click(function() {
$.getScript('../kindeditor-min.js', function() {
KindEditor.basePath = '../';
KindEditor.create('textarea[name="content"]');
});
});
$('input[name=remove]').click(function() {
KindEditor.remove('textarea[name="content"]');
});
});
</script>
</head>
<body>
<h3>异步加载</h3>
<form>
<textarea name="content" style="width:800px;height:200px;"></textarea>
<p>
<input type="button" name="load" value="加载JS并创建编辑器" />
<input type="button" name="remove" value="删除编辑器" />
</p>
</form>
</body>
</html>