–></mce:style><style type=”text/css” mce_bogus=”1″>        table.coll /*只有class属性为coll的才应用*/
        {
        border-collapse: collapse
        }
        table.sep
        {
        border-collapse: separate
        }
        .table/**/
        {
        border-collapse: separate;
        empty-cells: show
        }
    </style>
    <mce:script type=”text/javascript”><!–
        /***********************************
         /g是global全局替换,如果没有这个标识,只替换第一处
         /asdf/gi,i是忽略大小写。
         还有个m不常用,是否换行匹配
        ***********************************/
        String.prototype.htmlEncode = function(){
            return this.replace(/</g,”<”).replace(/>/g,”>”).replace(//n/g,”<br />”);
        };
        function f(){
            document.getElementById(“div1″).innerHTML=”<00<0>”.htmlEncode();//编码之后
            alert(“<00<0>”.htmlEncode());
            document.getElementById(“div2”).innerHTML=document.getElementById(“Text1”).value.htmlEncode();//输入<>/n之类试试
            alert(document.getElementById(“Text1″).value.htmlEncode());
        }
// –></mce:script>
</head>
<body>
<input id=”Text1″ type=”text” value=”<>/n” />
<div id=”div1″>hello</div>
<input type=”button” value=”ok” οnclick=”f();” />
<div id=”div2″>hi</div>
<table class=”coll” border=”1″>
    <tr>
        <td>hello</td>
        <td>hello</td>
    </tr>
    <tr>
        <td>hello</td>
        <td>hello</td>
    </tr>
</table>
<table class=”sep” border=”1″>
    <tr>
        <td>hello</td>
        <td>hello</td>
    </tr>
    <tr>
        <td>hello</td>
        <td>hello</td>
    </tr>
</table>
<table border=”1″ class=”table” style=” empty-cells:hide; text-transform:uppercase;” mce_style=” empty-cells:hide; text-transform:uppercase;”>
    <tr>
        <td>hello</td>
        <td>hello</td>
    </tr>
    <tr>
        <td></td>
        <td>hello</td>
    </tr>
</table>
</body>
</html>
   
 
