A friend who has used the Rich Text Editor may know that the content written in the editor, if there is a style change, when the webpage is displayed, it may be quite different from what you write. The reason is that global CSS is defined on the page. So how can we avoid global CSS? You can use IFRAME to process it .....
Example:
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br/> <HTML xmlns = "http://www.w3.org/1999/xhtml" XML: lang = "ZH" lang = "ZH" dir = "LTR"> <br/> <pead> <br/> <meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8 "/> </P> <p> <title> IFRAME avoids global CSS styles </title> <br/> <SCRIPT src =" http://code.jquery.com/jquery-latest.min.js "> </script> <br/> <SCRIPT type = "text/JavaScript"> <br/> $ (function () {<br/> var contents =$ (": hidden [name = contents]"). val (); <br/> $ ("# ifecontents "). CONTENTS (). find ("body "). append (contents); <br/> // IFRAME automatically adapts to the text content height <br/> window. setinterval ("reinitiframe ()", 200); <br/> }); <br/>/** <br/> * reinitiframe <br/> * @ return void <br/> */<br/> function reinitiframe () {<br/> var IFRAME = $ ("# ifecontents") [0]; <br/> var bheight = iframe.content+doc ument. body. scrollheight; <br/> var dheight = iframe.content?#document.doc umentelement. scrollheight; <br/> var Height = math. max (bheight, dheight); <br/> IFRAME. height = height; <br/>}</P> <p> </SCRIPT> </P> <p> </pead> <br/> <body> <br/> <form name = "frm" method = "Post"> <br/> <input name = "contents" type = "hidden" value = "Test Data"/> <br/> <IFRAME id = "ifecontents" frameborder = "0" allowtransparency = "true" tabindex = "0" src = "" style = "width: 100%; "scrolling =" Auto "> </iframe> <br/> </form> <br/> </body> <br/> </ptml>
PS:
- When using IFRAME, pay attention to its "scroll bar". If you do not want to see the scroll bar, you need to make the IFRAME adaptive height. The specific code is written in the above Code.