javascript從html代碼中獲取文字方法


function trimHtml(str){
    str = str.replace(/(\n)/g, "");
    str = str.replace(/(\t)/g, "");
    str = str.replace(/(\r)/g, "");
    str = str.replace(/<\/?[^>]*>/g, "");
    str = str.replace(/\s*/g, "");
    str = str.replace(/<[^>]*>/g,"");
    return str;
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



猜您在找 在HTML標簽 中調用javascript代碼 html中通過javaScript獲取請求中傳遞的參數 JavaScript獲取一段html片段中a標簽的href值 HTML iframe, 獲取iframe子頁面中的元素(基於JavaScript) HTML頁面中JavaScript能獲取到的各種屏幕大小信息 iframe中鑲嵌html頁,並獲取html頁中的方法 JAVA中執行JavaScript代碼並獲取返回值 HTML中javascript的