1 | <html> |
---|
2 | <head> |
---|
3 | <script type="text/javascript" src="./jquery.js"></script> |
---|
4 | <script type="text/javascript" src="./jquery-ui.js"></script> |
---|
5 | <script type="text/javascript"> |
---|
6 | $(function() { |
---|
7 | $("#list").sortable({ |
---|
8 | placeholder: 'ui-state-highlight' |
---|
9 | }); |
---|
10 | $("#list").disableSelection(); |
---|
11 | |
---|
12 | for (i=0;i<10;i++) |
---|
13 | { |
---|
14 | addEditor(); |
---|
15 | } |
---|
16 | }); |
---|
17 | |
---|
18 | |
---|
19 | |
---|
20 | |
---|
21 | function addEditor() |
---|
22 | { |
---|
23 | alert("Hello"); |
---|
24 | var editor_fields = document.editors.elements["editor[]"]; |
---|
25 | |
---|
26 | var editorAmount = 0; |
---|
27 | |
---|
28 | if (editor_fields.length) |
---|
29 | { |
---|
30 | editorAmount = editor_fields.length; |
---|
31 | } |
---|
32 | else |
---|
33 | { |
---|
34 | editorAmount = 1; |
---|
35 | } |
---|
36 | |
---|
37 | var newElem = $('#editor_container' + editorAmount).clone().attr('id', 'editor_container' + (editorAmount + 1)); |
---|
38 | |
---|
39 | newElem.html("<textarea class='editor' name='editor[]' id='editor" + (editorAmount + 1) + "' rows='4' cols='30'></textarea>"); |
---|
40 | |
---|
41 | $("#editor_container" + editorAmount).after(newElem); |
---|
42 | |
---|
43 | $("#editor" + (editorAmount + 1)).ckeditor(); |
---|
44 | } |
---|
45 | </script> |
---|
46 | </head> |
---|
47 | <body> |
---|
48 | |
---|
49 | <form name="editors"> |
---|
50 | <ul id="list"> |
---|
51 | <li name="editor_container1" id="editor_container1"><textarea name='editor[]' id='editor1' rows='4' cols='30'></textarea></li> |
---|
52 | </ul> |
---|
53 | </form> |
---|
54 | </body> |
---|
55 | </html> |
---|