Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <script type="text/javascript">
- var editorDoc;
- function InitEditable () {
- var editor = document.getElementById ("editor");
- editorDoc = editor.contentWindow.document;
- var editorBody = editorDoc.body;
- if ('spellcheck' in editorBody) {
- editorBody.spellcheck = false;
- }
- if ('contentEditable' in editorBody) {
- editorBody.contentEditable = true;
- }
- else {
- if ('designMode' in editorDoc) {
- editorDoc.designMode = "on";
- }
- }
- }
- function ToggleBold () {
- editorDoc.execCommand ('bold', false, null);
- }
- </script>
- <title></title>
- </head>
- <body onload="InitEditable ();">
- First, write and select some text in the editor.<br>
- <iframe id="editor" name="editor" src="editable.htm"></iframe><br>
- <br>
- You can toggle the bold/normal state of the selected text with this button:<br>
- <button onclick="ToggleBold ();">Bold</button>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement