<textarea id=textarea1>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">理化</SPAN>
</textarea>
<script language=vbs>
alert(ReplaceTest(textarea1.value))
Function ReplaceTest(strName)
Dim regEx
Set regEx = New RegExp
regEx.Pattern = "<.*?>"
regEx.IgnoreCase = True
regEx.global=true
ReplaceTest = regEx.Replace(strName, "")
End Function
</script>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">理化</SPAN>
</textarea>
<script language=vbs>
alert(ReplaceTest(textarea1.value))
Function ReplaceTest(strName)
Dim regEx
Set regEx = New RegExp
regEx.Pattern = "<.*?>"
regEx.IgnoreCase = True
regEx.global=true
ReplaceTest = regEx.Replace(strName, "")
End Function
</script>
<textarea id=textarea1>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">理化</SPAN>
</textarea>
<script >
var str=textarea1.value;
var re = /<[^>]*?>/gi;
str=str.replace(re, "")
alert(str);
</script>
能不能告诉我/<[^>]*?>/gi是什么意思啊?
匹配html标签<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
和
</SPAN>g全局匹配
i忽略大小写建议楼主看看正则表达式,很快就能掌握了