熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

使用javascript過濾html的字符串(注釋標記法)

2013-11-15 12:07:48  來源: JSP教程 
本篇文章是對使用javascript過濾html的字符串進行了詳細的分析介紹需要的朋友參考下   復制代碼 代碼如下:

  
function DeleteHtmlFromStartToEnd(str begin end) {
            str = strreplace(begin + end "");
            if (strindexOf(begin) == ) {//沒找到
                return str;
            }
            var substr = strsubstring(strindexOf(begin) + beginlength strindexOf(end));
            str = strreplace(substr "");
            return DeleteHtmlFromStartToEnd(str begin end);
        }
        var str = <!deleteBegin><!deleteEnd><!deleteBegin><!deleteEnd><!deleteBegin><!deleteEnd><!deleteBegin><!deleteEnd>;
        var result = DeleteHtmlFromStartToEnd(str <!deleteBegin> <!deleteEnd>);
        alert(result);


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20356.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.