14.5富文本編輯
阿新 • • 發佈:2018-11-05
rip design name height iframe width fun 富文本編輯 spa
1、iframe 方法
<body> <iframe name="richedit" src="表單驗證.html" style="height: 500px;width: 500px;"></iframe> <script> window.onload= function(){ frames[‘richedit‘].document.designMode = ‘on‘; } </script> </body>
2、使用contenteditable屬性
<body> <div style=‘width:200px;height:200px;border:1px solid black‘ id=‘richedit‘ contenteditable></div> <script> var div = document.getElementById(‘richedit‘); div.contenteditable = ‘true‘; </script> </body>
contenteditable屬性有3個可能的值:
true:表示打開
false:表示關閉
inherit:表示從父元素繼承
14.5富文本編輯