1 | <!DOCTYPE html> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <meta http-equiv="content-type" content="text/html; charset=UTF-8"> |
---|
5 | <title>Replace Textarea by Code — CKEditor Sample</title> |
---|
6 | <meta charset="utf-8"> |
---|
7 | </head> |
---|
8 | <body> |
---|
9 | <div id="testdiv1" style="margin:20px; width:500px;"></div> |
---|
10 | <div id="testdiv2" style="margin:20px; width:500px;"></div> |
---|
11 | <div id="testdiv3" style="margin:20px; width:500px;"></div> |
---|
12 | <div id="testdiv4" style="margin:20px; width:500px;"></div> |
---|
13 | <div id="testdiv5" style="margin:20px; width:500px;"></div> |
---|
14 | <div id="testdiv6" style="margin:20px; width:500px;"></div> |
---|
15 | <div id="testdiv7" style="margin:20px; width:500px;"></div> |
---|
16 | <div id="testdiv8" style="margin:20px; width:500px;"></div> |
---|
17 | <div id="testdiv9" style="margin:20px; width:500px;"></div> |
---|
18 | <div id="testdiv10" style="margin:20px; width:500px;"></div> |
---|
19 | <div id="testdiv11" style="margin:20px; width:500px;"></div> |
---|
20 | <div id="testdiv12" style="margin:20px; width:500px;"></div> |
---|
21 | <div id="testdiv13" style="margin:20px; width:500px;"></div> |
---|
22 | <div id="testdiv14" style="margin:20px; width:500px;"></div> |
---|
23 | <div id="testdiv15" style="margin:20px; width:500px;"></div> |
---|
24 | <script type="text/javascript"> |
---|
25 | |
---|
26 | function createIframe( number ) { |
---|
27 | var iframe = document.createElement( 'iframe' ); |
---|
28 | iframe.setAttribute( 'width', '500px' ); |
---|
29 | iframe.setAttribute( 'height', '200px' ); |
---|
30 | iframe.setAttribute( 'id', 'testIframe'+number ); |
---|
31 | var html = '<!DOCTYPE html><html><title>Cursor Stays</title><head><meta charset="utf-8"></head><body contenteditable="true">'+ |
---|
32 | '<p><span lang="EN" style="font-size:16.0pt;font-family:"Times New Roman","serif";mso-fareast-font-family:"Times New Roman";color:black;mso-ansi-language:EN">Introduction to '+number+'</span></p>'+ |
---|
33 | '<h1><img alt="Saturn V carrying Apollo 11" style="float:right;" src="http://192.168.1.100:8080/ckeditor4_git/samples/old/assets/sample.jpg" /> Apollo 11</h1>'+ |
---|
34 | '<p><strong>Apollo 11</strong> was the spaceflight that landed the first humans, Americans'+ |
---|
35 | '<a href="http://en.wikipedia.org/wiki/Neil_Armstrong" title="Neil Armstrong">Neil Armstrong</a> and <a href="http://en.wikipedia.org/wiki/Buzz_Aldrin" title="Buzz Aldrin">Buzz Aldrin</a>, '+ |
---|
36 | 'on the Moon on July 20, 1969, at 20:18 UTC. Armstrong became the first to step onto the lunar surface 6 hours later on July 21 at 02:56 UTC.</p>'+ |
---|
37 | '<p>iframe with editable <a href="http://ckeditor.com/">CKEditor</a>.</p></body></html>'; |
---|
38 | |
---|
39 | var myNav = navigator.userAgent.toLowerCase(); |
---|
40 | var ieVer8_10 = ( myNav.indexOf( 'msie' ) != -1 ) ? parseInt( myNav.split( 'msie' )[1] ) : false; |
---|
41 | var isIE11 = !!navigator.userAgent.match( /Trident.*rv[ :]*11\./ ); |
---|
42 | |
---|
43 | if( ( ieVer8_10 && ieVer8_10 >= 8 ) || isIE11 ) { |
---|
44 | document.getElementById( 'testdiv'+number ).appendChild( iframe ); |
---|
45 | document.getElementById( 'testIframe' ).contentWindow.document.write( html ); |
---|
46 | } else { |
---|
47 | iframe.setAttribute( 'src', 'data:text/html;charset=utf-8,' + encodeURI( html ) ); |
---|
48 | document.getElementById( 'testdiv'+number ).appendChild( iframe ); |
---|
49 | } |
---|
50 | } |
---|
51 | |
---|
52 | for(var i = 1; i <= 15; i++){ |
---|
53 | createIframe(i); |
---|
54 | } |
---|
55 | </script> |
---|
56 | </body> |
---|
57 | </html> |
---|