【发布时间】:2026-01-29 20:55:01
【问题描述】:
我正在尝试获取提供的 html (span) 之间的数据(在本例中为 31)
这是原始代码(来自 chrome 中的检查元素)
<span id="point_total" class="tooltip" oldtitle="Note: If the number is black, your points are actually a little bit negative. Don't worry, this just means you need to start subbing again." aria-describedby="ui-tooltip-0">31</span>
我有一个包含页面源的富文本框,这里是相同的代码,但在富文本框的第 51 行:
<DIV id=point_display>You have<BR><SPAN id=point_total class=tooltip jQuery16207621750175125325="23" oldtitle="Note: If the number is black, your points are actually a little bit negative. Don't worry, this just means you need to start subbing again.">17</SPAN><BR>Points </DIV><IMG style="FLOAT: right" title="Gain subscribers" border=0 alt="When people subscribe to you, you lose a point" src="http://static.subxcess.com/images/page/decoration/remove-1-point.png"> </DIV>
我该怎么做呢?我尝试了几种方法,但似乎都不适合我。
我正在尝试从此页面检索点值:http://www.subxcess.com/sub4sub.php 该数字会根据您的订阅者而有所不同。
【问题讨论】:
-
如果您需要在代码隐藏中访问它,您可以将“runat=server”添加到您的跨度并获取内部文本。
-
你可以使用 jquery 解决方案吗?
-
var yourdata = $('span').html();
-
我编写的程序是用 C# 编写的,因为我对它相当陌生,请您解释一下 jquery 解决方案是什么意思?我尝试了一些我在网上找到的正则表达式方法,我也尝试使用 HTMLAgility 库来查找字符串
-
您试图在哪里访问这些数据?在代码隐藏的c#代码中还是在客户端主动?