1 | <html> |
---|
2 | <head> |
---|
3 | <title>Example of HTMLArea 3.0</title> |
---|
4 | |
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
6 | |
---|
7 | <!-- load the main HTMLArea files --> |
---|
8 | <script type="text/javascript" src="htmlarea.js"></script> |
---|
9 | <script type="text/javascript" src="lang/en.js"></script> |
---|
10 | <script type="text/javascript" src="dialog.js"></script> |
---|
11 | <!-- <script type="text/javascript" src="popupdiv.js"></script> --> |
---|
12 | <script type="text/javascript" src="popupwin.js"></script> |
---|
13 | |
---|
14 | <!-- load the plugins --> |
---|
15 | <script type="text/javascript"> |
---|
16 | // WARNING: using this interface to load plugin |
---|
17 | // will _NOT_ work if plugins do not have the language |
---|
18 | // loaded by HTMLArea. |
---|
19 | |
---|
20 | // In other words, this function generates SCRIPT tags |
---|
21 | // that load the plugin and the language file, based on the |
---|
22 | // global variable HTMLArea.I18N.lang (defined in the lang file, |
---|
23 | // in our case "lang/en.js" loaded above). |
---|
24 | |
---|
25 | // If this lang file is not found the plugin will fail to |
---|
26 | // load correctly and nothing will work. |
---|
27 | |
---|
28 | HTMLArea.loadPlugin("TableOperations"); |
---|
29 | HTMLArea.loadPlugin("SpellChecker"); |
---|
30 | </script> |
---|
31 | |
---|
32 | <style type="text/css"> |
---|
33 | @import url(htmlarea.css); |
---|
34 | |
---|
35 | html, body { |
---|
36 | font-family: Verdana,sans-serif; |
---|
37 | background-color: #fea; |
---|
38 | color: #000; |
---|
39 | } |
---|
40 | a:link, a:visited { color: #00f; } |
---|
41 | a:hover { color: #048; } |
---|
42 | a:active { color: #f00; } |
---|
43 | |
---|
44 | textarea { background-color: #fff; border: 1px solid 00f; } |
---|
45 | </style> |
---|
46 | |
---|
47 | <script type="text/javascript"> |
---|
48 | var editor = null; |
---|
49 | function initEditor() { |
---|
50 | // create an editor for the "ta" textbox |
---|
51 | editor = new HTMLArea("ta"); |
---|
52 | |
---|
53 | // register the SpellChecker plugin |
---|
54 | editor.registerPlugin("TableOperations"); |
---|
55 | |
---|
56 | // register the SpellChecker plugin |
---|
57 | editor.registerPlugin("SpellChecker"); |
---|
58 | |
---|
59 | editor.generate(); |
---|
60 | return false; |
---|
61 | } |
---|
62 | |
---|
63 | function insertHTML() { |
---|
64 | var html = prompt("Enter some HTML code here"); |
---|
65 | if (html) { |
---|
66 | editor.insertHTML(html); |
---|
67 | } |
---|
68 | } |
---|
69 | function highlight() { |
---|
70 | editor.surroundHTML('<span style="background-color: yellow">', '</span>'); |
---|
71 | } |
---|
72 | </script> |
---|
73 | |
---|
74 | </head> |
---|
75 | |
---|
76 | <!-- use <body onload="HTMLArea.replaceAll()" if you don't care about |
---|
77 | customizing the editor. It's the easiest way! :) --> |
---|
78 | <body onload="initEditor()"> |
---|
79 | |
---|
80 | <h1>HTMLArea 3.0</h1> |
---|
81 | |
---|
82 | <p>A replacement for <code>TEXTAREA</code> elements. © <a |
---|
83 | href="http://interactivetools.com">InteractiveTools.com</a>, 2003.</p> |
---|
84 | |
---|
85 | <p>Plugins: |
---|
86 | <tt>TableOperations<tt> | |
---|
87 | <tt>SpellChecker</tt> |
---|
88 | </p> |
---|
89 | |
---|
90 | <form action="test.cgi" method="post" id="edit" name="edit"> |
---|
91 | |
---|
92 | <textarea id="ta" name="ta" style="width:100%" rows="24" cols="80"> |
---|
93 | |
---|
94 | <h1>This is the fully loaded HTMLArea ;-)</h1> |
---|
95 | |
---|
96 | <p>It loads all the plugins that have been developed so far.</p> |
---|
97 | |
---|
98 | <table style="background-color: #99f; border: 1px dashed #08f; width: |
---|
99 | 60%; border-collapse: collapse;" align="center"> |
---|
100 | <tr style="background-color: #fdd"> |
---|
101 | <td style="font-weight: bold; border: 1px solid #000;">Plugin</td> |
---|
102 | <td style="font-weight: bold; border: 1px solid #000;">Sponsor</td> |
---|
103 | </tr> |
---|
104 | |
---|
105 | <tr> |
---|
106 | <td style="font-family: monospace">TableOperations</td> |
---|
107 | <td><a href="http://bloki.com">Zapatec, Inc.</a></td> |
---|
108 | </tr> |
---|
109 | |
---|
110 | <tr> |
---|
111 | <td style="font-family: monospace">SpellChecker</td> |
---|
112 | <td><a href="http://americanbible.org">Amerian Bible Society</a></td> |
---|
113 | </tr> |
---|
114 | </table> |
---|
115 | |
---|
116 | </textarea> |
---|
117 | |
---|
118 | <p /> |
---|
119 | |
---|
120 | <input type="submit" name="ok" value=" submit " /> |
---|
121 | <input type="button" name="ins" value=" insert html " onclick="return insertHTML();" /> |
---|
122 | <input type="button" name="hil" value=" highlight text " onclick="return highlight();" /> |
---|
123 | |
---|
124 | <a href="javascript:mySubmit()">submit</a> |
---|
125 | |
---|
126 | <script type="text/javascript"> |
---|
127 | function mySubmit() { |
---|
128 | // document.edit.save.value = "yes"; |
---|
129 | document.edit.onsubmit(); // workaround browser bugs. |
---|
130 | document.edit.submit(); |
---|
131 | }; |
---|
132 | </script> |
---|
133 | |
---|
134 | </form> |
---|
135 | |
---|
136 | </body> |
---|
137 | </html> |
---|