如何获取html页面的所有文字

如何获取html页面的所有文字,第1张

用正则表达式的方法

<SCRIPT LANGUAGE="vbScript">

dim str

str="怎样从一个Html页面中提取所有汉字呢?不能有其它Html代码。"

alert RegExpTest("[\u4e00-\u9fa5]",str)

Function RegExpTest(patrn, strng)

Dim regEx, Match, Matches ' 建立变量。

Set regEx = New RegExp ' 建立正则表达式。

regEx.Pattern = patrn ' 设置模式。

regEx.IgnoreCase = True ' 设置是否区分大小写。

regEx.Global = True ' 设置全局替换。

Set Matches = regEx.Execute(strng) ' 执行搜索。

For Each Match in Matches ' 遍历 Matches 集合。

RetStr = RetStr & Match.Value

Next

RegExpTest = RetStr

End Function

</SCRIPT>

需要准备的材料分别有:电脑、浏览器、html编辑器

1、首先,打开html编辑器,新建html文件,例如:index.html,编写问题基础代码。

2、在index.html中的<table>标签中输入样式代码:style="font-size: 28px"。

3、浏览器运行index.html页面,此时整个表格的字体大小被统一为了28px。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/8368050.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-15
下一篇2023-04-15

发表评论

登录后才能评论

评论列表(0条)

    保存