var str = '<!-- 注釋1 --><h1 style="color:#00ff00;text-align: center;">ProsperLee<!-- 注釋 --></h1>'; document.write(str.replace(/<!--[\w\W\r\n]*?-->/gmi, '')); // 去除HTML中的注釋 document.write(str.replace(/<[^>]+>/g,"")); // 去除HTML標簽 document.write(str.replace(/(<[^\s\/>]+)\b[^>]*>/gi,"$1>")); // 去除HTML標簽中的屬性