Java html 編輯器原理
來自:http://hi.baidu.com/zdz8207/blog/item/19bb2b34b0ea093a5ab5f560.html
<DIV contenteditable="true" style="border:dashed blue 2px">Hello World!</DIV>
保存為html網頁,打開看看,在DIV里出現了一個光標,這個DIV就變成可以編輯的了。
類似的,SPAN,FONT等都可以有 contenteditable="true" 這個屬性。
再試試下面的:
<DIV contenteditable="true" style="border:dashed blue 2px">Hello World!
<IMG src="http://p.blog.csdn.net/images/p_blog_csdn_net/comstep/70786/o_logo.jpg" />
</DIV>我們就可以拉伸圖片了。
二、具體實現:
1、需要兩個頁面,blank.html editor.html
2、blank.html 作為 editor.html的一個內嵌Frame,作為編輯框。
<html>
<body topmargin="10" leftmargin="10" bgColor="#f6f6f6">
<div id="RTC" contenteditable = true></div>
</body>
</html>
posted on 2012-07-14 09:07 歐陽良才 閱讀(358) 評論(0) 編輯 收藏 所屬分類: JAVA